Repository: empire-db Updated Branches: refs/heads/master 8dbffdbc5 -> caaec0de9
http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/java/org/apache/empire/rest/service/listener/AppListener.java ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/java/org/apache/empire/rest/service/listener/AppListener.java b/empire-db-vue-example/src/main/java/org/apache/empire/rest/service/listener/AppListener.java deleted file mode 100644 index 8cee6ed..0000000 --- a/empire-db-vue-example/src/main/java/org/apache/empire/rest/service/listener/AppListener.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.empire.rest.service.listener; - -import java.sql.Connection; -import java.sql.DriverManager; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.empire.commons.StringUtils; -import org.apache.empire.db.DBCommand; -import org.apache.empire.db.DBDatabase; -import org.apache.empire.db.DBDatabaseDriver; -import org.apache.empire.db.DBRecord; -import org.apache.empire.db.DBSQLScript; -import org.apache.empire.db.exceptions.QueryFailedException; -import org.apache.empire.db.hsql.DBDatabaseDriverHSql; -import org.apache.empire.db.mysql.DBDatabaseDriverMySQL; -import org.apache.empire.vuesample.model.EmpireServiceConsts; -import org.apache.empire.vuesample.model.db.SampleDB; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.Level; -import org.apache.log4j.PatternLayout; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AppListener implements ServletContextListener { - - private static final Logger log = LoggerFactory.getLogger(AppListener.class); - - @Override - public void contextInitialized(ServletContextEvent sce) { - - log.debug("contextInitialized"); - - // Logging - initLogging(); - - // - Connection conn = getJDBCConnection(sce.getServletContext()); - - // DB - SampleDB db = initDatabase(sce.getServletContext()); - DBDatabaseDriver driver = new DBDatabaseDriverMySQL(); - db.open(driver, conn); - - // Add to context - sce.getServletContext().setAttribute(EmpireServiceConsts.ATTRIBUTE_DB, db); - // sce.getServletContext().setAttribute(MobileImportServiceConsts.ATTRIBUTE_DATASOURCE, ds); - // sce.getServletContext().setAttribute(MobileImportServiceConsts.ATTRIBUTE_CONFIG, config); - - log.debug("contextInitialized done"); - - } - - @Override - public void contextDestroyed(ServletContextEvent sce) { - log.debug("contextDestroyed"); - log.debug("contextDestroyed done"); - } - - private SampleDB initDatabase(ServletContext ctx) { - SampleDB db = new SampleDB(); - - // Open Database (and create if not existing) - DBDatabaseDriver driver = new DBDatabaseDriverHSql(); - log.info("Opening database '{}' using driver '{}'", db.getClass().getSimpleName(), driver.getClass().getSimpleName()); - Connection conn = null; - try { - conn = getJDBCConnection(ctx); - db.open(driver, conn); - if (!databaseExists(db, conn)) { - // STEP 4: Create Database - log.info("Creating database {}", db.getClass().getSimpleName()); - createSampleDatabase(db, driver, conn); - } - } finally { - releaseConnection(db, conn, true); - } - - return db; - } - - private static boolean databaseExists(SampleDB db, Connection conn) { - // Check wether DB exists - DBCommand cmd = db.createCommand(); - cmd.select(db.T_DEPARTMENTS.count()); - try { - return (db.querySingleInt(cmd, -1, conn) >= 0); - } catch (QueryFailedException e) { - return false; - } - } - - private static void createSampleDatabase(SampleDB db, DBDatabaseDriver driver, Connection conn) { - // create DLL for Database Definition - DBSQLScript script = new DBSQLScript(); - db.getCreateDDLScript(driver, script); - // Show DLL Statements - System.out.println(script.toString()); - // Execute Script - script.executeAll(driver, conn, false); - db.commit(conn); - // Open again - if (!db.isOpen()) { - db.open(driver, conn); - } - // Insert Sample Departments - insertDepartmentSampleRecord(db, conn, "Procurement", "ITTK"); - int idDevDep = insertDepartmentSampleRecord(db, conn, "Development", "ITTK"); - int idSalDep = insertDepartmentSampleRecord(db, conn, "Sales", "ITTK"); - // Insert Sample Employees - insertEmployeeSampleRecord(db, conn, "Mr.", "Eugen", "Miller", "M", idDevDep); - insertEmployeeSampleRecord(db, conn, "Mr.", "Max", "Mc. Callahan", "M", idDevDep); - insertEmployeeSampleRecord(db, conn, "Mrs.", "Anna", "Smith", "F", idSalDep); - // Commit - db.commit(conn); - } - - private static int insertDepartmentSampleRecord(SampleDB db, Connection conn, String department_name, String businessUnit) { - // Insert a Department - DBRecord rec = new DBRecord(); - rec.create(db.T_DEPARTMENTS); - rec.setValue(db.T_DEPARTMENTS.NAME, department_name); - rec.setValue(db.T_DEPARTMENTS.BUSINESS_UNIT, businessUnit); - try { - rec.update(conn); - } catch (Exception e) { - log.error(e.getLocalizedMessage()); - return 0; - } - // Return Department ID - return rec.getInt(db.T_DEPARTMENTS.DEPARTMENT_ID); - } - - /* - * Insert a person - */ - private static int insertEmployeeSampleRecord(SampleDB db, Connection conn, String salutation, String firstName, String lastName, String gender, int depID) { - // Insert an Employee - DBRecord rec = new DBRecord(); - rec.create(db.T_EMPLOYEES); - rec.setValue(db.T_EMPLOYEES.SALUTATION, salutation); - rec.setValue(db.T_EMPLOYEES.FIRST_NAME, firstName); - rec.setValue(db.T_EMPLOYEES.LAST_NAME, lastName); - rec.setValue(db.T_EMPLOYEES.GENDER, gender); - rec.setValue(db.T_EMPLOYEES.DEPARTMENT_ID, depID); - try { - rec.update(conn); - } catch (Exception e) { - log.error(e.getLocalizedMessage()); - return 0; - } - // Return Employee ID - return rec.getInt(db.T_EMPLOYEES.EMPLOYEE_ID); - } - - public static Connection getJDBCConnection(ServletContext appContext) { - // Establish a new database connection - Connection conn = null; - - String jdbcURL = "jdbc:hsqldb:file:hsqldb/sample;shutdown=true"; - String jdbcUser = "sa"; - String jdbcPwd = ""; - - if (jdbcURL.indexOf("file:") > 0) { - jdbcURL = StringUtils.replace(jdbcURL, "file:", "file:" + appContext.getRealPath("/")); - } - // Connect - log.info("Connecting to Database'" + jdbcURL + "' / User=" + jdbcUser); - try { // Connect to the databse - Class.forName("org.hsqldb.jdbcDriver").newInstance(); - conn = DriverManager.getConnection(jdbcURL, jdbcUser, jdbcPwd); - log.info("Connected successfully"); - // set the AutoCommit to false this session. You must commit - // explicitly now - conn.setAutoCommit(false); - log.info("AutoCommit is " + conn.getAutoCommit()); - - } catch (Exception e) { - log.error("Failed to connect directly to '" + jdbcURL + "' / User=" + jdbcUser); - log.error(e.toString()); - throw new RuntimeException(e); - } - return conn; - } - - protected void releaseConnection(DBDatabase db, Connection conn, boolean commit) { - // release connection - if (conn == null) { - return; - } - // Commit or rollback connection depending on the exit code - if (commit) { // success: commit all changes - db.commit(conn); - log.debug("REQUEST {}: commited."); - } else { // failure: rollback all changes - db.rollback(conn); - log.debug("REQUEST {}: rolled back."); - } - } - - private void initLogging() { - - // Init Logging - ConsoleAppender consoleAppender = new ConsoleAppender(); - String pattern = "%-5p [%d{yyyy/MM/dd HH:mm}]: %m at %l %n"; - consoleAppender.setLayout(new PatternLayout(pattern)); - consoleAppender.activateOptions(); - - org.apache.log4j.Logger.getRootLogger().addAppender(consoleAppender); - org.apache.log4j.Logger.getRootLogger().setLevel(Level.ALL); - - Level loglevel = Level.DEBUG; - log.info("Setting LogLevel to {}", loglevel); - - // RootLogger - org.apache.log4j.Logger.getRootLogger().setLevel(Level.INFO); - - // Empire-db Logs - org.apache.log4j.Logger empireLog = org.apache.log4j.Logger.getLogger("org.apache.empire.db.DBDatabase"); - empireLog.setLevel(loglevel); - - // Vue.js Sample - org.apache.log4j.Logger miLog = org.apache.log4j.Logger.getLogger("org.apache.empire.rest"); - miLog.setLevel(loglevel); - - } - -} http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/EmpireServiceConsts.java ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/EmpireServiceConsts.java b/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/EmpireServiceConsts.java deleted file mode 100644 index f95dc4c..0000000 --- a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/EmpireServiceConsts.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.empire.vuesample.model; - -public class EmpireServiceConsts { - - public static final String ATTRIBUTE_DB = "db"; - - public static final String ATTRIBUTE_CONNECTION = "connection"; - - public static final String ATTRIBUTE_DATASOURCE = "ds"; - - public static final String ATTRIBUTE_CONFIG = "config"; - -} http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/EmployeeBean.java ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/EmployeeBean.java b/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/EmployeeBean.java deleted file mode 100644 index 048c793..0000000 --- a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/EmployeeBean.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.empire.vuesample.model.db; - -import org.apache.empire.rest.EmpireColumn; - -public class EmployeeBean { - - private EmpireColumn employeeId; - - private EmpireColumn firstName; - - private EmpireColumn lastName; - - private EmpireColumn dateOfBirth; - - public EmpireColumn getEmployeeId() { - return this.employeeId; - } - - public void setEmployeeId(EmpireColumn employeeId) { - this.employeeId = employeeId; - } - - public EmpireColumn getFirstName() { - return this.firstName; - } - - public void setFirstName(EmpireColumn firstName) { - this.firstName = firstName; - } - - public EmpireColumn getLastName() { - return this.lastName; - } - - public void setLastName(EmpireColumn lastName) { - this.lastName = lastName; - } - - public EmpireColumn getDateOfBirth() { - return this.dateOfBirth; - } - - public void setDateOfBirth(EmpireColumn dateOfBirth) { - this.dateOfBirth = dateOfBirth; - } - -} http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleDB.java ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleDB.java b/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleDB.java deleted file mode 100644 index 735d323..0000000 --- a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleDB.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.empire.vuesample.model.db; - -import org.apache.empire.commons.Options; -import org.apache.empire.data.DataMode; -import org.apache.empire.data.DataType; -import org.apache.empire.db.DBColumn; -import org.apache.empire.db.DBDatabase; -import org.apache.empire.db.DBTableColumn; - -public class SampleDB extends DBDatabase -{ - private final static long serialVersionUID = 1L; - - // Declare all Tables - public final TDepartments T_DEPARTMENTS = new TDepartments(this); - public final TEmployees T_EMPLOYEES = new TEmployees(this); - - /** - * Constructor SampleDB - */ - public SampleDB() - { - // Define Foreign-Key Relations - addRelation(T_EMPLOYEES.DEPARTMENT_ID.referenceOn(T_DEPARTMENTS.DEPARTMENT_ID)); - } - - // Needed for the DBELResolver - @Override - protected void register(String id) - { - super.register("db"); - } - - /** - * This class represents the definition of the Departments table. - */ - public static class TDepartments extends SampleTable - { - private static final long serialVersionUID = 1L; - - public final DBTableColumn DEPARTMENT_ID; - public final DBTableColumn NAME; - public final DBTableColumn HEAD; - public final DBTableColumn BUSINESS_UNIT; - public final DBTableColumn UPDATE_TIMESTAMP; - - public TDepartments(DBDatabase db) - { - super("DEPARTMENTS", db); - // ID - DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, DataMode.NotNull, "DEP_ID_SEQUENCE"); - NAME = addColumn("NAME", DataType.TEXT, 80, DataMode.NotNull); - HEAD = addColumn("HEAD", DataType.TEXT, 80, DataMode.Nullable); - BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.TEXT, 4, DataMode.NotNull, "ITTK"); - UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.DATETIME, 0, DataMode.NotNull); - - // Primary Key - setPrimaryKey(DEPARTMENT_ID); - // Set other Indexes - addIndex("DEARTMENT_NAME_IDX", true, new DBColumn[] { NAME }); - // Set timestamp column for save updates - setTimestampColumn(UPDATE_TIMESTAMP); - - } - } - - - - /** - * This class represents the definition of the Employees table. - */ - public static class TEmployees extends SampleTable - { - private static final long serialVersionUID = 1L; - - public final DBTableColumn EMPLOYEE_ID; - public final DBTableColumn SALUTATION; -// public final DBTableColumn PICTURE; - public final DBTableColumn FIRST_NAME; - public final DBTableColumn LAST_NAME; - public final DBTableColumn DATE_OF_BIRTH; - public final DBTableColumn DEPARTMENT_ID; - public final DBTableColumn GENDER; - public final DBTableColumn PHONE_NUMBER; - public final DBTableColumn EMAIL; - public final DBTableColumn RETIRED; - public final DBTableColumn UPDATE_TIMESTAMP; - public TEmployees(DBDatabase db) - { - super("EMPLOYEES", db); - // ID - EMPLOYEE_ID = addColumn("EMPLOYEE_ID", DataType.AUTOINC, 0, DataMode.NotNull, "EMPLOYEE_ID_SEQUENCE"); - SALUTATION = addColumn("SALUTATION", DataType.TEXT, 5, DataMode.Nullable); - FIRST_NAME = addColumn("FIRST_NAME", DataType.TEXT, 40, DataMode.NotNull); - LAST_NAME = addColumn("LAST_NAME", DataType.TEXT, 40, DataMode.NotNull); - DATE_OF_BIRTH = addColumn("DATE_OF_BIRTH", DataType.DATE, 0, DataMode.Nullable); - DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.INTEGER, 0, DataMode.NotNull); - GENDER = addColumn("GENDER", DataType.TEXT, 1, DataMode.Nullable); - PHONE_NUMBER = addColumn("PHONE_NUMBER", DataType.TEXT, 40, DataMode.Nullable); - EMAIL = addColumn("EMAIL", DataType.TEXT, 80, DataMode.Nullable); - RETIRED = addColumn("RETIRED", DataType.BOOL, 0, DataMode.NotNull, false); - // PICTURE = addColumn("PICTURE", DataType.BLOB, 0, DataMode.Nullable); - UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.DATETIME, 0, DataMode.NotNull); - - // Primary Key - setPrimaryKey(EMPLOYEE_ID); - // Set other Indexes - addIndex("PERSON_NAME_IDX", true, new DBColumn[] { FIRST_NAME, LAST_NAME, DATE_OF_BIRTH }); - - // Set timestamp column for save updates - setTimestampColumn(UPDATE_TIMESTAMP); - - // Create Options for GENDER column - Options genders = new Options(); - genders.set("M", "!option.employee.gender.male"); - genders.set("F", "!option.employee.gender.female"); - GENDER.setOptions(genders); - GENDER.setControlType("select"); - - Options retired = new Options(); - retired.set(false, "!option.employee.active"); - retired.set(true, "!option.employee.retired"); - RETIRED.setOptions(retired); - RETIRED.setControlType("checkbox"); - - // Set special control types - DEPARTMENT_ID.setControlType("select"); - PHONE_NUMBER .setControlType("phone"); - - // Set optional formatting attributes - DATE_OF_BIRTH.setAttribute("format:date", "yyyy-MM-dd"); - - // PICTURE.setControlType("blob"); - - } - } - -} http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleTable.java ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleTable.java b/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleTable.java deleted file mode 100644 index 353bf75..0000000 --- a/empire-db-vue-example/src/main/java/org/apache/empire/vuesample/model/db/SampleTable.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.empire.vuesample.model.db; - -import java.util.Locale; - -import org.apache.empire.data.DataType; -import org.apache.empire.db.DBDatabase; -import org.apache.empire.db.DBTable; -import org.apache.empire.db.DBTableColumn; - -/** - * Base class definition for all database tables Automatically generates a message-key for the field title e.g. for the column - * EMPLOYEES.DATE_OF_BIRTH it generates the key "!field.title.employees.dateOfBirth"; - */ -public class SampleTable extends DBTable -{ - private final static long serialVersionUID = 1L; - public final String MESSAGE_KEY_PREFIX = "!field.title."; - - public SampleTable(String name, DBDatabase db) - { - super(name, db); - } - - @Override - protected void addColumn(DBTableColumn column) - { - // Set Translation Title - String col = column.getBeanPropertyName(); - String tbl = getName().toLowerCase(); - String key = MESSAGE_KEY_PREFIX + tbl + "." + col; - column.setTitle(key); - - // Set Default Control Type - DataType type = column.getDataType(); - column.setControlType((type == DataType.BOOL) ? "checkbox" : "text"); - - // Add Column - super.addColumn(column); - } - - public enum LanguageIndex { - DE(Locale.GERMAN), - - EN(Locale.ENGLISH); - - private final Locale locale; - - private LanguageIndex(Locale locale) - { - this.locale = locale; - } - - public Locale getLocale() - { - return this.locale; - } - - public String getDBLangKey() - { - return this.name().toUpperCase(); - } - } -} http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/webapp/WEB-INF/web.xml b/empire-db-vue-example/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 123c05a..0000000 --- a/empire-db-vue-example/src/main/webapp/WEB-INF/web.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. --> -<web-app id="vue-example" version="3.0" - xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> - - <servlet> - <servlet-name>Jersey Web Application</servlet-name> - <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> - <init-param> - <param-name>jersey.config.server.provider.packages</param-name> - <param-value>org.apache.empire.rest.service</param-value> - </init-param> - <load-on-startup>1</load-on-startup> - </servlet> - - <servlet-mapping> - <servlet-name>Jersey Web Application</servlet-name> - <url-pattern>/ws/*</url-pattern> - </servlet-mapping> - - <welcome-file-list> - <welcome-file>index.html</welcome-file> - </welcome-file-list> - - <listener> - <listener-class>org.apache.empire.rest.service.listener.AppListener</listener-class> - </listener> - -</web-app> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/webapp/components/einput/einput.js ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/webapp/components/einput/einput.js b/empire-db-vue-example/src/main/webapp/components/einput/einput.js deleted file mode 100644 index e84c400..0000000 --- a/empire-db-vue-example/src/main/webapp/components/einput/einput.js +++ /dev/null @@ -1,25 +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. - */ -Vue.component('einput', { - - props: ['col'], - - template: '<input v-bind:value="col.value" v-bind:type="col.meta.type" v-bind:required="col.meta.required" v-bind:readonly="col.meta.readonly" v-bind:maxlength="col.meta.size"></input>' - -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/webapp/index.html ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/webapp/index.html b/empire-db-vue-example/src/main/webapp/index.html deleted file mode 100644 index 6f332ee..0000000 --- a/empire-db-vue-example/src/main/webapp/index.html +++ /dev/null @@ -1,57 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - --> -<!DOCTYPE html> -<html> -<head> - <title></title> - <!-- <script src="js/jquery-3.2.1.min.js"></script> --> - <!-- <script src="https://unpkg.com/vue"></script> --> - <script src="components/einput/einput.js"></script> -</head> -<body> - - <div id="app"> - - <table> - - <tr> - <td>ID</td> - <td><einput v-bind:col="employee.employeeId"></einput></td> - </tr> - <tr> - <td>Last Name</td> - <td><einput v-bind:col="employee.lastName"></einput></td> - </tr> - <tr> - <td>First name</td> - <td><einput v-bind:col="employee.firstName"></einput></td> - </tr> - <tr> - <td>Date of Birth</td> - <td><einput v-bind:col="employee.dateOfBirth"></einput></td> - </tr> - - </table> - - </div> - - <script src="js/app.js"></script> - -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/empire-db/blob/caaec0de/empire-db-vue-example/src/main/webapp/js/app.js ---------------------------------------------------------------------- diff --git a/empire-db-vue-example/src/main/webapp/js/app.js b/empire-db-vue-example/src/main/webapp/js/app.js deleted file mode 100644 index eeed1c5..0000000 --- a/empire-db-vue-example/src/main/webapp/js/app.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -var vm = new Vue({ - - el: '#app', - - created: function () { - this.loadEmployee(1); - }, - - data: { - employee: {} - }, - - methods: { - - loadEmployee: function (id) { - var self = this; - $.getJSON("ws/employee/" + id, function(data) { - self.employee = data; - }); - } - - } - -}); \ No newline at end of file
