You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/05/18 05:36:25 UTC
[18/26] openmeetings git commit: Normalize all the line endings
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java
index 0f2edba..696bd8c 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java
@@ -1,55 +1,55 @@
-/*
- * 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.openmeetings.backup;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.user.User;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class UserConverter extends OmConverter<User> {
- private UserDao userDao;
- private Map<Long, Long> idMap;
-
- public UserConverter() {
- //default constructor is for export
- }
-
- public UserConverter(UserDao userDao, Map<Long, Long> idMap) {
- this.userDao = userDao;
- this.idMap = idMap;
- }
-
- @Override
- public User read(InputNode node) throws Exception {
- long oldId = getLong(node);
- Long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId;
-
- User u = userDao.get(newId);
- return u == null ? new User() : u;
- }
-
- @Override
- public void write(OutputNode node, User value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" : "" + value.getId());
- }
+/*
+ * 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.openmeetings.backup;
+
+import java.util.Map;
+
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.user.User;
+import org.simpleframework.xml.stream.InputNode;
+import org.simpleframework.xml.stream.OutputNode;
+
+public class UserConverter extends OmConverter<User> {
+ private UserDao userDao;
+ private Map<Long, Long> idMap;
+
+ public UserConverter() {
+ //default constructor is for export
+ }
+
+ public UserConverter(UserDao userDao, Map<Long, Long> idMap) {
+ this.userDao = userDao;
+ this.idMap = idMap;
+ }
+
+ @Override
+ public User read(InputNode node) throws Exception {
+ long oldId = getLong(node);
+ Long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId;
+
+ User u = userDao.get(newId);
+ return u == null ? new User() : u;
+ }
+
+ @Override
+ public void write(OutputNode node, User value) throws Exception {
+ node.setData(true);
+ node.setValue(value == null ? "0" : "" + value.getId());
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
index d91011b..a5b562c 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
@@ -1,189 +1,189 @@
-/*
- * 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.openmeetings.cli;
-
-import java.io.File;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.openmeetings.util.ConnectionProperties.DbType;
-import org.apache.openmeetings.util.ConnectionProperties;
-import org.apache.openmeetings.util.OmFileHelper;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public abstract class ConnectionPropertiesPatcher {
- protected static final String URL_PREFIX = "Url";
- protected static final String DRIVER_PREFIX = "DriverClassName";
- protected static final String USER_PREFIX = "Username";
- protected static final String PASS_PREFIX = "Password";
- protected ConnectionProperties props;
-
- public static ConnectionPropertiesPatcher getPatcher(ConnectionProperties props) {
- ConnectionPropertiesPatcher patcher = null;
- switch (props.getDbType()) {
- case db2:
- patcher = new Db2Patcher();
- break;
- case mssql:
- patcher = new MssqlPatcher();
- break;
- case mysql:
- patcher = new MysqlPatcher();
- break;
- case oracle:
- patcher = new OraclePatcher();
- break;
- case postgresql:
- patcher = new PostgresPatcher();
- break;
- case derby:
- default:
- patcher = new DerbyPatcher();
- break;
- }
- patcher.props = props;
- return patcher;
- }
-
- public static ConnectionProperties getConnectionProperties(File conf) throws Exception {
- ConnectionProperties props = new ConnectionProperties();
- Document doc = getDocument(conf);
- Attr attr = getConnectionProperties(doc);
- String[] tokens = attr.getValue().split(",");
- loadProperties(tokens, props);
-
- return props;
- }
-
- private static Document getDocument(File xml) throws Exception {
- DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
- //dbFactory.setNamespaceAware(true);
- DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
- return dBuilder.parse(xml);
- }
-
- private static Attr getConnectionProperties(Document doc) throws Exception {
- XPath xPath = XPathFactory.newInstance().newXPath();
- XPathExpression expr = xPath.compile("/persistence/persistence-unit/properties/property[@name='openjpa.ConnectionProperties']");
-
- Element element = (Element)expr.evaluate(doc, XPathConstants.NODE);
- return element.getAttributeNode("value");
- }
-
- public static void patch(ConnectionProperties props) throws Exception {
- ConnectionPropertiesPatcher patcher = getPatcher(props);
- Document doc = getDocument(OmFileHelper.getPersistence(props.getDbType()));
- Attr attr = getConnectionProperties(doc);
- String[] tokens = attr.getValue().split(",");
- patcher.patchAttribute(tokens);
- attr.setValue(StringUtils.join(tokens, ","));
-
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- Transformer transformer = transformerFactory.newTransformer();
- DOMSource source = new DOMSource(doc);
- transformer.transform(source, new StreamResult(OmFileHelper.getPersistence().getCanonicalPath())); //this constructor is used to avoid transforming path to URI
- }
-
- public static ConnectionProperties patch(String dbType, String host, String port, String db, String user, String pass) throws Exception {
- ConnectionProperties props = getConnectionProperties(OmFileHelper.getPersistence(dbType));
- props.setLogin(user);
- props.setPassword(pass);
- ConnectionPropertiesPatcher patcher = getPatcher(props);
- props.setURL(patcher.getUrl(props.getURL(), host, port, db));
- patch(props);
- return props;
- }
-
- public static void updateUrl(ConnectionProperties props, String host, String port, String db) {
- ConnectionPropertiesPatcher patcher = getPatcher(props);
- props.setURL(patcher.getUrl(props.getURL(), host, port, db));
- }
-
- protected void patchAttribute(String[] tokens) {
- for (int i = 0; i < tokens.length; ++i) {
- patchProp(tokens, i, USER_PREFIX, props.getLogin());
- patchProp(tokens, i, PASS_PREFIX, props.getPassword() == null ? "" : props.getPassword());
- patchProp(tokens, i, URL_PREFIX, props.getURL());
- }
- }
-
- protected static void patchProp(String[] tokens, int idx, String name, String value) {
- String prop = tokens[idx].trim();
- if (prop.startsWith(name)) {
- prop = name + "=" + StringEscapeUtils.escapeXml10(value);
- tokens[idx] = prop;
- }
- }
-
- private static void loadProperties(String[] tokens, ConnectionProperties connectionProperties) {
- String prop;
- for (int i = 0; i < tokens.length; ++i) {
- prop = getPropFromPersistence(tokens, i, DRIVER_PREFIX);
- if (prop != null) {
- connectionProperties.setDriver(prop);
- }
-
- prop = getPropFromPersistence(tokens, i, USER_PREFIX);
- if (prop != null) {
- connectionProperties.setLogin(prop);
- }
-
- prop = getPropFromPersistence(tokens, i, PASS_PREFIX);
- if (prop != null) {
- connectionProperties.setPassword(prop);
- }
-
- prop = getPropFromPersistence(tokens, i, URL_PREFIX);
- if (prop != null) {
- try {
- //will try to "guess" dbType
- String[] parts = prop.split(":");
- connectionProperties.setDbType("sqlserver".equals(parts[1]) ? DbType.mssql : DbType.valueOf(parts[1]));
- } catch (Exception e) {
- //ignore
- }
- connectionProperties.setURL(prop);
- }
- }
- }
-
- protected static String getPropFromPersistence(String[] tokens, int idx, String name){
- String prop = tokens[idx].trim();
- if (prop.startsWith(name)) {
- //From "Username=root" getting only "root"
- return prop.substring(prop.indexOf("=") + 1);
- }
- return null;
- }
-
- protected abstract String getUrl(String url, String host, String port, String db);
-}
+/*
+ * 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.openmeetings.cli;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.openmeetings.util.ConnectionProperties.DbType;
+import org.apache.openmeetings.util.ConnectionProperties;
+import org.apache.openmeetings.util.OmFileHelper;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public abstract class ConnectionPropertiesPatcher {
+ protected static final String URL_PREFIX = "Url";
+ protected static final String DRIVER_PREFIX = "DriverClassName";
+ protected static final String USER_PREFIX = "Username";
+ protected static final String PASS_PREFIX = "Password";
+ protected ConnectionProperties props;
+
+ public static ConnectionPropertiesPatcher getPatcher(ConnectionProperties props) {
+ ConnectionPropertiesPatcher patcher = null;
+ switch (props.getDbType()) {
+ case db2:
+ patcher = new Db2Patcher();
+ break;
+ case mssql:
+ patcher = new MssqlPatcher();
+ break;
+ case mysql:
+ patcher = new MysqlPatcher();
+ break;
+ case oracle:
+ patcher = new OraclePatcher();
+ break;
+ case postgresql:
+ patcher = new PostgresPatcher();
+ break;
+ case derby:
+ default:
+ patcher = new DerbyPatcher();
+ break;
+ }
+ patcher.props = props;
+ return patcher;
+ }
+
+ public static ConnectionProperties getConnectionProperties(File conf) throws Exception {
+ ConnectionProperties props = new ConnectionProperties();
+ Document doc = getDocument(conf);
+ Attr attr = getConnectionProperties(doc);
+ String[] tokens = attr.getValue().split(",");
+ loadProperties(tokens, props);
+
+ return props;
+ }
+
+ private static Document getDocument(File xml) throws Exception {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ //dbFactory.setNamespaceAware(true);
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ return dBuilder.parse(xml);
+ }
+
+ private static Attr getConnectionProperties(Document doc) throws Exception {
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ XPathExpression expr = xPath.compile("/persistence/persistence-unit/properties/property[@name='openjpa.ConnectionProperties']");
+
+ Element element = (Element)expr.evaluate(doc, XPathConstants.NODE);
+ return element.getAttributeNode("value");
+ }
+
+ public static void patch(ConnectionProperties props) throws Exception {
+ ConnectionPropertiesPatcher patcher = getPatcher(props);
+ Document doc = getDocument(OmFileHelper.getPersistence(props.getDbType()));
+ Attr attr = getConnectionProperties(doc);
+ String[] tokens = attr.getValue().split(",");
+ patcher.patchAttribute(tokens);
+ attr.setValue(StringUtils.join(tokens, ","));
+
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ DOMSource source = new DOMSource(doc);
+ transformer.transform(source, new StreamResult(OmFileHelper.getPersistence().getCanonicalPath())); //this constructor is used to avoid transforming path to URI
+ }
+
+ public static ConnectionProperties patch(String dbType, String host, String port, String db, String user, String pass) throws Exception {
+ ConnectionProperties props = getConnectionProperties(OmFileHelper.getPersistence(dbType));
+ props.setLogin(user);
+ props.setPassword(pass);
+ ConnectionPropertiesPatcher patcher = getPatcher(props);
+ props.setURL(patcher.getUrl(props.getURL(), host, port, db));
+ patch(props);
+ return props;
+ }
+
+ public static void updateUrl(ConnectionProperties props, String host, String port, String db) {
+ ConnectionPropertiesPatcher patcher = getPatcher(props);
+ props.setURL(patcher.getUrl(props.getURL(), host, port, db));
+ }
+
+ protected void patchAttribute(String[] tokens) {
+ for (int i = 0; i < tokens.length; ++i) {
+ patchProp(tokens, i, USER_PREFIX, props.getLogin());
+ patchProp(tokens, i, PASS_PREFIX, props.getPassword() == null ? "" : props.getPassword());
+ patchProp(tokens, i, URL_PREFIX, props.getURL());
+ }
+ }
+
+ protected static void patchProp(String[] tokens, int idx, String name, String value) {
+ String prop = tokens[idx].trim();
+ if (prop.startsWith(name)) {
+ prop = name + "=" + StringEscapeUtils.escapeXml10(value);
+ tokens[idx] = prop;
+ }
+ }
+
+ private static void loadProperties(String[] tokens, ConnectionProperties connectionProperties) {
+ String prop;
+ for (int i = 0; i < tokens.length; ++i) {
+ prop = getPropFromPersistence(tokens, i, DRIVER_PREFIX);
+ if (prop != null) {
+ connectionProperties.setDriver(prop);
+ }
+
+ prop = getPropFromPersistence(tokens, i, USER_PREFIX);
+ if (prop != null) {
+ connectionProperties.setLogin(prop);
+ }
+
+ prop = getPropFromPersistence(tokens, i, PASS_PREFIX);
+ if (prop != null) {
+ connectionProperties.setPassword(prop);
+ }
+
+ prop = getPropFromPersistence(tokens, i, URL_PREFIX);
+ if (prop != null) {
+ try {
+ //will try to "guess" dbType
+ String[] parts = prop.split(":");
+ connectionProperties.setDbType("sqlserver".equals(parts[1]) ? DbType.mssql : DbType.valueOf(parts[1]));
+ } catch (Exception e) {
+ //ignore
+ }
+ connectionProperties.setURL(prop);
+ }
+ }
+ }
+
+ protected static String getPropFromPersistence(String[] tokens, int idx, String name){
+ String prop = tokens[idx].trim();
+ if (prop.startsWith(name)) {
+ //From "Username=root" getting only "root"
+ return prop.substring(prop.indexOf("=") + 1);
+ }
+ return null;
+ }
+
+ protected abstract String getUrl(String url, String host, String port, String db);
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Db2Patcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Db2Patcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Db2Patcher.java
index b681979..2103db1 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Db2Patcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Db2Patcher.java
@@ -1,28 +1,28 @@
-/*
- * 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.openmeetings.cli;
-
-public class Db2Patcher extends ConnectionPropertiesPatcher {
- @Override
- protected String getUrl(String _url, String host, String _port, String _db) {
- String port = (_port == null) ? "50000" : _port;
- String db = (_db == null) ? "openmeet" : _db;
- return "jdbc:db2://" + host + ":" + port + "/" + db;
- }
-}
+/*
+ * 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.openmeetings.cli;
+
+public class Db2Patcher extends ConnectionPropertiesPatcher {
+ @Override
+ protected String getUrl(String _url, String host, String _port, String _db) {
+ String port = (_port == null) ? "50000" : _port;
+ String db = (_db == null) ? "openmeet" : _db;
+ return "jdbc:db2://" + host + ":" + port + "/" + db;
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/DerbyPatcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/DerbyPatcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/DerbyPatcher.java
index ff5498e..ea55963 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/DerbyPatcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/DerbyPatcher.java
@@ -1,33 +1,33 @@
-/*
- * 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.openmeetings.cli;
-
-public class DerbyPatcher extends ConnectionPropertiesPatcher {
- @Override
- protected String getUrl(String _url, String host, String _port, String _db) {
- String db = (_db == null) ? "openmeetings" : _db;
- String suffix = _url.substring(_url.indexOf(';'));
-
- if (host != null && _port != null) {
- //return "jdbc:derby" + "://" + host + ":" + _port + "/" + db + suffix;
- }
-
- return "jdbc:derby" + ":" + db + suffix;
- }
-}
+/*
+ * 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.openmeetings.cli;
+
+public class DerbyPatcher extends ConnectionPropertiesPatcher {
+ @Override
+ protected String getUrl(String _url, String host, String _port, String _db) {
+ String db = (_db == null) ? "openmeetings" : _db;
+ String suffix = _url.substring(_url.indexOf(';'));
+
+ if (host != null && _port != null) {
+ //return "jdbc:derby" + "://" + host + ":" + _port + "/" + db + suffix;
+ }
+
+ return "jdbc:derby" + ":" + db + suffix;
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MssqlPatcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MssqlPatcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MssqlPatcher.java
index 681331d..2bd04a8 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MssqlPatcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MssqlPatcher.java
@@ -1,28 +1,28 @@
-/*
- * 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.openmeetings.cli;
-
-public class MssqlPatcher extends ConnectionPropertiesPatcher {
- @Override
- protected String getUrl(String _url, String host, String _port, String _db) {
- String port = (_port == null) ? "1433" : _port;
- String db = (_db == null) ? "openmeetings" : _db;
- return "jdbc:sqlserver://" + host + ":" + port + ";databaseName=" + db;
- }
-}
+/*
+ * 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.openmeetings.cli;
+
+public class MssqlPatcher extends ConnectionPropertiesPatcher {
+ @Override
+ protected String getUrl(String _url, String host, String _port, String _db) {
+ String port = (_port == null) ? "1433" : _port;
+ String db = (_db == null) ? "openmeetings" : _db;
+ return "jdbc:sqlserver://" + host + ":" + port + ";databaseName=" + db;
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MysqlPatcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MysqlPatcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MysqlPatcher.java
index 163e710..2a3c7d4 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MysqlPatcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/MysqlPatcher.java
@@ -1,29 +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.
- */
-package org.apache.openmeetings.cli;
-
-public class MysqlPatcher extends ConnectionPropertiesPatcher {
- @Override
- protected String getUrl(String _url, String host, String _port, String _db) {
- String port = (_port == null) ? "3306" : _port;
- String db = (_db == null) ? "openmeetings" : _db;
- String suffix = _url.substring(_url.indexOf('?'));
- return "jdbc:mysql://" + host + ":" + port + "/" + db + suffix;
- }
-}
+/*
+ * 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.openmeetings.cli;
+
+public class MysqlPatcher extends ConnectionPropertiesPatcher {
+ @Override
+ protected String getUrl(String _url, String host, String _port, String _db) {
+ String port = (_port == null) ? "3306" : _port;
+ String db = (_db == null) ? "openmeetings" : _db;
+ String suffix = _url.substring(_url.indexOf('?'));
+ return "jdbc:mysql://" + host + ":" + port + "/" + db + suffix;
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/OraclePatcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/OraclePatcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/OraclePatcher.java
index c9a04a9..bb2db07 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/OraclePatcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/OraclePatcher.java
@@ -1,32 +1,32 @@
-/*
- * 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.openmeetings.cli;
-
-public class OraclePatcher extends ConnectionPropertiesPatcher {
- @Override
- protected String getUrl(String _url, String host, String _port, String _db) {
- String port = (_port == null) ? "1521" : _port;
- String db = (_db == null) ? "openmeetings" : _db;
- String delim = ":";
- if (db.startsWith("/")) {
- delim = "";
- }
- return String.format("jdbc:oracle:thin:@%s:%s%s%s", host, port, delim, db);
- }
-}
+/*
+ * 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.openmeetings.cli;
+
+public class OraclePatcher extends ConnectionPropertiesPatcher {
+ @Override
+ protected String getUrl(String _url, String host, String _port, String _db) {
+ String port = (_port == null) ? "1521" : _port;
+ String db = (_db == null) ? "openmeetings" : _db;
+ String delim = ":";
+ if (db.startsWith("/")) {
+ delim = "";
+ }
+ return String.format("jdbc:oracle:thin:@%s:%s%s%s", host, port, delim, db);
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/cli/PostgresPatcher.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/PostgresPatcher.java b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/PostgresPatcher.java
index e1b885c..975f6dc 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/PostgresPatcher.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/PostgresPatcher.java
@@ -1,28 +1,28 @@
-/*
- * 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.openmeetings.cli;
-
-public class PostgresPatcher extends ConnectionPropertiesPatcher {
- @Override
- protected String getUrl(String _url, String host, String _port, String _db) {
- String port = (_port == null) ? "5432" : _port;
- String db = (_db == null) ? "openmeetings" : _db;
- return "jdbc:postgresql://" + host + ":" + port + "/" + db;
- }
-}
+/*
+ * 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.openmeetings.cli;
+
+public class PostgresPatcher extends ConnectionPropertiesPatcher {
+ @Override
+ protected String getUrl(String _url, String host, String _port, String _db) {
+ String port = (_port == null) ? "5432" : _port;
+ String db = (_db == null) ? "openmeetings" : _db;
+ return "jdbc:postgresql://" + host + ":" + port + "/" + db;
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationConfig.java
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationConfig.java b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationConfig.java
index 5e1f297..7fbf8ac 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationConfig.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationConfig.java
@@ -1,100 +1,100 @@
-/*
- * 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.openmeetings.installation;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.DEFAULT_BASE_URL;
-
-import java.io.Serializable;
-
-import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
-import org.apache.openmeetings.util.crypt.SHA256Implementation;
-
-public class InstallationConfig implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public String appName = ConfigurationDao.DEFAULT_APP_NAME;
- public String username;
- private String password;
- public String email;
- public String group;
- public String allowFrontendRegister = "1";
- public String createDefaultRooms = "1";
- public String ical_timeZone = "Europe/Berlin";
-
- public String cryptClassName = SHA256Implementation.class.getCanonicalName();
- //email
- public Integer smtpPort = 25;
- public String smtpServer = "localhost";
- public String mailAuthName = "";
- public String mailAuthPass = "";
- public String mailReferer = "noreply@openmeetings.apache.org";
- public String mailUseTls = "0";
- //paths
- public Integer swfZoom = 100;
- public Integer swfJpegQuality = 85;
- public String swfPath = "";
- public String imageMagicPath = "";
- public String ffmpegPath = "";
- public String soxPath = "";
- public String officePath = "";
-
- public String defaultLangId = "1";
- public String sendEmailAtRegister = "0";
- public String urlFeed = "http://mail-archives.apache.org/mod_mbox/openmeetings-user/?format=atom";
- public String urlFeed2 = "http://mail-archives.apache.org/mod_mbox/openmeetings-dev/?format=atom";
- public String sendEmailWithVerficationCode = "0";
- public String defaultExportFont = "TimesNewRoman";
- public String red5SipEnable = "no";
- public String red5SipRoomPrefix = "400";
- public String red5SipExtenContext = "rooms";
- public String replyToOrganizer = "1";
- public String baseUrl = DEFAULT_BASE_URL;
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- @Override
- public String toString() {
- return "InstallationConfig [allowFrontendRegister="
- + allowFrontendRegister + ", createDefaultRooms="
- + createDefaultRooms + ", cryptClassName=" + cryptClassName
- + ", smtpPort=" + smtpPort + ", smtpServer=" + smtpServer
- + ", mailAuthName=" + mailAuthName + ", mailAuthPass="
- + mailAuthPass + ", mailReferer=" + mailReferer
- + ", mailUseTls=" + mailUseTls + ", swfZoom=" + swfZoom
- + ", swfJpegQuality=" + swfJpegQuality + ", swfPath=" + swfPath
- + ", imageMagicPath=" + imageMagicPath + ", ffmpegPath="
- + ffmpegPath + ", soxPath=" + soxPath
- + ", defaultLangId=" + defaultLangId + ", sendEmailAtRegister="
- + sendEmailAtRegister + ", urlFeed=" + urlFeed + ", urlFeed2="
- + urlFeed2 + ", sendEmailWithVerficationCode="
- + sendEmailWithVerficationCode + ", defaultExportFont="
- + defaultExportFont + ", red5SipEnable="
- + red5SipEnable + ", red5SipRoomPrefix=" + red5SipRoomPrefix
- + ", red5SipExtenContext=" + red5SipExtenContext
- + ", replyToOrganizer=" + replyToOrganizer
- + ", ical_timeZone=" + ical_timeZone
- + "]";
- }
-}
+/*
+ * 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.openmeetings.installation;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.DEFAULT_BASE_URL;
+
+import java.io.Serializable;
+
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.util.crypt.SHA256Implementation;
+
+public class InstallationConfig implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public String appName = ConfigurationDao.DEFAULT_APP_NAME;
+ public String username;
+ private String password;
+ public String email;
+ public String group;
+ public String allowFrontendRegister = "1";
+ public String createDefaultRooms = "1";
+ public String ical_timeZone = "Europe/Berlin";
+
+ public String cryptClassName = SHA256Implementation.class.getCanonicalName();
+ //email
+ public Integer smtpPort = 25;
+ public String smtpServer = "localhost";
+ public String mailAuthName = "";
+ public String mailAuthPass = "";
+ public String mailReferer = "noreply@openmeetings.apache.org";
+ public String mailUseTls = "0";
+ //paths
+ public Integer swfZoom = 100;
+ public Integer swfJpegQuality = 85;
+ public String swfPath = "";
+ public String imageMagicPath = "";
+ public String ffmpegPath = "";
+ public String soxPath = "";
+ public String officePath = "";
+
+ public String defaultLangId = "1";
+ public String sendEmailAtRegister = "0";
+ public String urlFeed = "http://mail-archives.apache.org/mod_mbox/openmeetings-user/?format=atom";
+ public String urlFeed2 = "http://mail-archives.apache.org/mod_mbox/openmeetings-dev/?format=atom";
+ public String sendEmailWithVerficationCode = "0";
+ public String defaultExportFont = "TimesNewRoman";
+ public String red5SipEnable = "no";
+ public String red5SipRoomPrefix = "400";
+ public String red5SipExtenContext = "rooms";
+ public String replyToOrganizer = "1";
+ public String baseUrl = DEFAULT_BASE_URL;
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Override
+ public String toString() {
+ return "InstallationConfig [allowFrontendRegister="
+ + allowFrontendRegister + ", createDefaultRooms="
+ + createDefaultRooms + ", cryptClassName=" + cryptClassName
+ + ", smtpPort=" + smtpPort + ", smtpServer=" + smtpServer
+ + ", mailAuthName=" + mailAuthName + ", mailAuthPass="
+ + mailAuthPass + ", mailReferer=" + mailReferer
+ + ", mailUseTls=" + mailUseTls + ", swfZoom=" + swfZoom
+ + ", swfJpegQuality=" + swfJpegQuality + ", swfPath=" + swfPath
+ + ", imageMagicPath=" + imageMagicPath + ", ffmpegPath="
+ + ffmpegPath + ", soxPath=" + soxPath
+ + ", defaultLangId=" + defaultLangId + ", sendEmailAtRegister="
+ + sendEmailAtRegister + ", urlFeed=" + urlFeed + ", urlFeed2="
+ + urlFeed2 + ", sendEmailWithVerficationCode="
+ + sendEmailWithVerficationCode + ", defaultExportFont="
+ + defaultExportFont + ", red5SipEnable="
+ + red5SipEnable + ", red5SipRoomPrefix=" + red5SipRoomPrefix
+ + ", red5SipExtenContext=" + red5SipExtenContext
+ + ", replyToOrganizer=" + replyToOrganizer
+ + ", ical_timeZone=" + ical_timeZone
+ + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-install/src/site/site.xml
----------------------------------------------------------------------
diff --git a/openmeetings-install/src/site/site.xml b/openmeetings-install/src/site/site.xml
index b7a0eae..dd3dc53 100644
--- a/openmeetings-install/src/site/site.xml
+++ b/openmeetings-install/src/site/site.xml
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
- -->
-<project xmlns="http://maven.apache.org/DECORATION/1.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"
- name="Apache OpenMeetings Project">
-
- <body>
- <menu ref="parent"/>
- <menu name="Project">
- <item name="About" href="/index.html" />
- <item name="Info" href="/project-info.html" />
- <item name="Summary" href="/project-summary.html" />
- <item name="License" href="/license.html" />
- <item name="Dependencies" href="/dependencies.html" />
- <item name="Dependency Convergence" href="/dependency-convergence.html" />
- <item name="RAT Report" href="/rat-report.html" />
- </menu>
- </body>
- <custom>
- <reflowSkin>
- <bottomNav maxSpan="12">
- <column>Parent Project</column>
- <column>Project</column>
- </bottomNav>
- </reflowSkin>
- </custom>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/DECORATION/1.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"
+ name="Apache OpenMeetings Project">
+
+ <body>
+ <menu ref="parent"/>
+ <menu name="Project">
+ <item name="About" href="/index.html" />
+ <item name="Info" href="/project-info.html" />
+ <item name="Summary" href="/project-summary.html" />
+ <item name="License" href="/license.html" />
+ <item name="Dependencies" href="/dependencies.html" />
+ <item name="Dependency Convergence" href="/dependency-convergence.html" />
+ <item name="RAT Report" href="/rat-report.html" />
+ </menu>
+ </body>
+ <custom>
+ <reflowSkin>
+ <bottomNav maxSpan="12">
+ <column>Parent Project</column>
+ <column>Project</column>
+ </bottomNav>
+ </reflowSkin>
+ </custom>
+</project>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java
----------------------------------------------------------------------
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java
index d17d56b..0ce3502 100644
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java
+++ b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java
@@ -1,237 +1,237 @@
-/*
- * 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.openmeetings.screenshare;
-
-import static org.apache.openmeetings.screenshare.Core.QUARTZ_GROUP_NAME;
-import static org.apache.openmeetings.screenshare.gui.ScreenDimensions.FPS;
-import static org.apache.openmeetings.screenshare.util.Util.getQurtzProps;
-import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Queue;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.openmeetings.screenshare.job.CursorJob;
-import org.apache.openmeetings.screenshare.job.EncodeJob;
-import org.apache.openmeetings.screenshare.job.SendJob;
-import org.quartz.JobBuilder;
-import org.quartz.JobDetail;
-import org.quartz.JobKey;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.quartz.SchedulerFactory;
-import org.quartz.Trigger;
-import org.quartz.TriggerBuilder;
-import org.quartz.impl.StdSchedulerFactory;
-import org.red5.server.api.Red5;
-import org.red5.server.net.rtmp.event.VideoData;
-import org.red5.server.stream.message.RTMPMessage;
-import org.slf4j.Logger;
-
-public class CaptureScreen extends Thread {
- private static final Logger log = getLogger(CaptureScreen.class);
- private final static String QUARTZ_CURSOR_TRIGGER_NAME = "CursorTrigger";
- private final static String QUARTZ_CURSOR_JOB_NAME = "CursorJob";
- private Core core;
- private int timestampDelta;
- private volatile AtomicInteger timestamp = new AtomicInteger(0);
- private volatile AtomicBoolean sendFrameGuard = new AtomicBoolean(false);
- private long startTime = 0;
- private volatile boolean active = true;
- private IScreenEncoder se;
- private IScreenShare client;
- private Queue<VideoData> frames = new ArrayBlockingQueue<>(2);
- private String host = null;
- private String app = null;
- private int port = -1;
- private Number streamId;
- private boolean startPublish = false;
- private Scheduler _scheduler;
-
- public CaptureScreen(Core coreScreenShare, IScreenShare client, String host, String app, int port) {
- core = coreScreenShare;
- this.client = client;
- this.host = host;
- this.app = app;
- this.port = port;
- }
-
- private Scheduler getScheduler() {
- if (_scheduler == null) {
- try {
- SchedulerFactory schdlrFactory = new StdSchedulerFactory(getQurtzProps("CaptureScreen"));
- _scheduler = schdlrFactory.getScheduler();
- } catch (SchedulerException e) {
- log.error("Unexpected error while creating scheduler", e);
- }
- }
- return _scheduler;
- }
-
- public void release() {
- try {
- if (_scheduler != null) {
- _scheduler.shutdown(true);
- _scheduler = null;
- }
- } catch (Exception e) {
- log.error("Unexpected error while shutting down scheduler", e);
- }
- active = false;
- timestamp = new AtomicInteger(0);
- startTime = 0;
- }
-
- @Override
- public void run() {
- try {
- while (active && !core.isReadyToRecord()) {
- Thread.sleep(60);
- }
-
- timestampDelta = 1000 / FPS;
- se = new ScreenV1Encoder(3 * FPS); //send keyframe every 3 seconds
- startTime = System.currentTimeMillis();
-
- JobDetail encodeJob = JobBuilder.newJob(EncodeJob.class).withIdentity("EncodeJob", QUARTZ_GROUP_NAME).build();
- encodeJob.getJobDataMap().put(EncodeJob.CAPTURE_KEY, this);
- Trigger encodeTrigger = TriggerBuilder.newTrigger()
- .withIdentity("EncodeTrigger", QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(timestampDelta).repeatForever())
- .build();
- JobDetail sendJob = JobBuilder.newJob(SendJob.class).withIdentity("SendJob", QUARTZ_GROUP_NAME).build();
- Trigger sendTrigger = TriggerBuilder.newTrigger()
- .withIdentity("SendTrigger", QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(timestampDelta).repeatForever())
- .build();
- sendJob.getJobDataMap().put(SendJob.CAPTURE_KEY, this);
-
- Scheduler s = getScheduler();
- s.scheduleJob(encodeJob, encodeTrigger);
- s.scheduleJob(sendJob, sendTrigger);
- s.start();
- } catch (Exception e) {
- log.error("Error while running: ", e);
- }
- }
-
- /*
- private void pushAudio(byte[] audio, long ts) {
- if (startPublish) {
- buffer.put((byte) 6);
- buffer.put(audio);
- buffer.flip();
-
- // I can stream audio
- //packets successfully using linear PCM at 11025Hz. For those packets I
- //push one byte (0x06) which specifies the format of audio data in a
- //ByteBuffer, and then real audio data:
- RTMPMessage rtmpMsg = RTMPMessage.build(new AudioData(buffer), (int) ts);
- client.publishStreamData(streamId, rtmpMsg);
- }
- }
- */
-
- public void pushVideo(VideoData data, int ts) {
- if (startPublish) {
- if (Red5.getConnectionLocal() == null) {
- Red5.setConnectionLocal(client.getConnection());
- }
- RTMPMessage rtmpMsg = RTMPMessage.build(data, ts);
- client.publishStreamData(streamId, rtmpMsg);
- }
- }
-
- public String getHost() {
- return host;
- }
-
- public String getApp() {
- return app;
- }
-
- public int getPort() {
- return port;
- }
-
- public Number getStreamId() {
- return streamId;
- }
-
- public void setStreamId(Number streamId) {
- this.streamId = streamId;
- }
-
- public void setStartPublish(boolean startPublish) {
- this.startPublish = startPublish;
- }
-
- public IScreenEncoder getEncoder() {
- return se;
- }
-
- public Queue<VideoData> getFrames() {
- return frames;
- }
-
- public void setSendFrameGuard(boolean b) {
- sendFrameGuard.set(b);
- }
-
- public boolean getSendFrameGuard() {
- return sendFrameGuard.get();
- }
-
- public AtomicInteger getTimestamp() {
- return timestamp;
- }
-
- public long getStartTime() {
- return startTime;
- }
-
- public int getTimestampDelta() {
- return timestampDelta;
- }
-
- public void sendCursorStatus() {
- core.sendCursorStatus();
- }
-
- public void setSendCursor(boolean sendCursor) {
- try {
- Scheduler s = getScheduler();
- if (sendCursor) {
- JobDetail cursorJob = JobBuilder.newJob(CursorJob.class).withIdentity(QUARTZ_CURSOR_JOB_NAME, QUARTZ_GROUP_NAME).build();
- Trigger cursorTrigger = TriggerBuilder.newTrigger()
- .withIdentity(QUARTZ_CURSOR_TRIGGER_NAME, QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(1000 / Math.min(5, FPS)).repeatForever())
- .build();
- cursorJob.getJobDataMap().put(CursorJob.CAPTURE_KEY, this);
- s.scheduleJob(cursorJob, cursorTrigger);
- } else {
- s.deleteJob(JobKey.jobKey(QUARTZ_CURSOR_JOB_NAME, QUARTZ_GROUP_NAME));
- }
- } catch (SchedulerException e) {
- log.error("Unexpected Error schedule/unschedule cursor job", e);
- }
- }
-}
+/*
+ * 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.openmeetings.screenshare;
+
+import static org.apache.openmeetings.screenshare.Core.QUARTZ_GROUP_NAME;
+import static org.apache.openmeetings.screenshare.gui.ScreenDimensions.FPS;
+import static org.apache.openmeetings.screenshare.util.Util.getQurtzProps;
+import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.Queue;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.openmeetings.screenshare.job.CursorJob;
+import org.apache.openmeetings.screenshare.job.EncodeJob;
+import org.apache.openmeetings.screenshare.job.SendJob;
+import org.quartz.JobBuilder;
+import org.quartz.JobDetail;
+import org.quartz.JobKey;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.SchedulerFactory;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
+import org.quartz.impl.StdSchedulerFactory;
+import org.red5.server.api.Red5;
+import org.red5.server.net.rtmp.event.VideoData;
+import org.red5.server.stream.message.RTMPMessage;
+import org.slf4j.Logger;
+
+public class CaptureScreen extends Thread {
+ private static final Logger log = getLogger(CaptureScreen.class);
+ private final static String QUARTZ_CURSOR_TRIGGER_NAME = "CursorTrigger";
+ private final static String QUARTZ_CURSOR_JOB_NAME = "CursorJob";
+ private Core core;
+ private int timestampDelta;
+ private volatile AtomicInteger timestamp = new AtomicInteger(0);
+ private volatile AtomicBoolean sendFrameGuard = new AtomicBoolean(false);
+ private long startTime = 0;
+ private volatile boolean active = true;
+ private IScreenEncoder se;
+ private IScreenShare client;
+ private Queue<VideoData> frames = new ArrayBlockingQueue<>(2);
+ private String host = null;
+ private String app = null;
+ private int port = -1;
+ private Number streamId;
+ private boolean startPublish = false;
+ private Scheduler _scheduler;
+
+ public CaptureScreen(Core coreScreenShare, IScreenShare client, String host, String app, int port) {
+ core = coreScreenShare;
+ this.client = client;
+ this.host = host;
+ this.app = app;
+ this.port = port;
+ }
+
+ private Scheduler getScheduler() {
+ if (_scheduler == null) {
+ try {
+ SchedulerFactory schdlrFactory = new StdSchedulerFactory(getQurtzProps("CaptureScreen"));
+ _scheduler = schdlrFactory.getScheduler();
+ } catch (SchedulerException e) {
+ log.error("Unexpected error while creating scheduler", e);
+ }
+ }
+ return _scheduler;
+ }
+
+ public void release() {
+ try {
+ if (_scheduler != null) {
+ _scheduler.shutdown(true);
+ _scheduler = null;
+ }
+ } catch (Exception e) {
+ log.error("Unexpected error while shutting down scheduler", e);
+ }
+ active = false;
+ timestamp = new AtomicInteger(0);
+ startTime = 0;
+ }
+
+ @Override
+ public void run() {
+ try {
+ while (active && !core.isReadyToRecord()) {
+ Thread.sleep(60);
+ }
+
+ timestampDelta = 1000 / FPS;
+ se = new ScreenV1Encoder(3 * FPS); //send keyframe every 3 seconds
+ startTime = System.currentTimeMillis();
+
+ JobDetail encodeJob = JobBuilder.newJob(EncodeJob.class).withIdentity("EncodeJob", QUARTZ_GROUP_NAME).build();
+ encodeJob.getJobDataMap().put(EncodeJob.CAPTURE_KEY, this);
+ Trigger encodeTrigger = TriggerBuilder.newTrigger()
+ .withIdentity("EncodeTrigger", QUARTZ_GROUP_NAME)
+ .withSchedule(simpleSchedule().withIntervalInMilliseconds(timestampDelta).repeatForever())
+ .build();
+ JobDetail sendJob = JobBuilder.newJob(SendJob.class).withIdentity("SendJob", QUARTZ_GROUP_NAME).build();
+ Trigger sendTrigger = TriggerBuilder.newTrigger()
+ .withIdentity("SendTrigger", QUARTZ_GROUP_NAME)
+ .withSchedule(simpleSchedule().withIntervalInMilliseconds(timestampDelta).repeatForever())
+ .build();
+ sendJob.getJobDataMap().put(SendJob.CAPTURE_KEY, this);
+
+ Scheduler s = getScheduler();
+ s.scheduleJob(encodeJob, encodeTrigger);
+ s.scheduleJob(sendJob, sendTrigger);
+ s.start();
+ } catch (Exception e) {
+ log.error("Error while running: ", e);
+ }
+ }
+
+ /*
+ private void pushAudio(byte[] audio, long ts) {
+ if (startPublish) {
+ buffer.put((byte) 6);
+ buffer.put(audio);
+ buffer.flip();
+
+ // I can stream audio
+ //packets successfully using linear PCM at 11025Hz. For those packets I
+ //push one byte (0x06) which specifies the format of audio data in a
+ //ByteBuffer, and then real audio data:
+ RTMPMessage rtmpMsg = RTMPMessage.build(new AudioData(buffer), (int) ts);
+ client.publishStreamData(streamId, rtmpMsg);
+ }
+ }
+ */
+
+ public void pushVideo(VideoData data, int ts) {
+ if (startPublish) {
+ if (Red5.getConnectionLocal() == null) {
+ Red5.setConnectionLocal(client.getConnection());
+ }
+ RTMPMessage rtmpMsg = RTMPMessage.build(data, ts);
+ client.publishStreamData(streamId, rtmpMsg);
+ }
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public String getApp() {
+ return app;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public Number getStreamId() {
+ return streamId;
+ }
+
+ public void setStreamId(Number streamId) {
+ this.streamId = streamId;
+ }
+
+ public void setStartPublish(boolean startPublish) {
+ this.startPublish = startPublish;
+ }
+
+ public IScreenEncoder getEncoder() {
+ return se;
+ }
+
+ public Queue<VideoData> getFrames() {
+ return frames;
+ }
+
+ public void setSendFrameGuard(boolean b) {
+ sendFrameGuard.set(b);
+ }
+
+ public boolean getSendFrameGuard() {
+ return sendFrameGuard.get();
+ }
+
+ public AtomicInteger getTimestamp() {
+ return timestamp;
+ }
+
+ public long getStartTime() {
+ return startTime;
+ }
+
+ public int getTimestampDelta() {
+ return timestampDelta;
+ }
+
+ public void sendCursorStatus() {
+ core.sendCursorStatus();
+ }
+
+ public void setSendCursor(boolean sendCursor) {
+ try {
+ Scheduler s = getScheduler();
+ if (sendCursor) {
+ JobDetail cursorJob = JobBuilder.newJob(CursorJob.class).withIdentity(QUARTZ_CURSOR_JOB_NAME, QUARTZ_GROUP_NAME).build();
+ Trigger cursorTrigger = TriggerBuilder.newTrigger()
+ .withIdentity(QUARTZ_CURSOR_TRIGGER_NAME, QUARTZ_GROUP_NAME)
+ .withSchedule(simpleSchedule().withIntervalInMilliseconds(1000 / Math.min(5, FPS)).repeatForever())
+ .build();
+ cursorJob.getJobDataMap().put(CursorJob.CAPTURE_KEY, this);
+ s.scheduleJob(cursorJob, cursorTrigger);
+ } else {
+ s.deleteJob(JobKey.jobKey(QUARTZ_CURSOR_JOB_NAME, QUARTZ_GROUP_NAME));
+ }
+ } catch (SchedulerException e) {
+ log.error("Unexpected Error schedule/unschedule cursor job", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java
----------------------------------------------------------------------
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java
index 3c31281..26dcb4b 100644
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java
+++ b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java
@@ -1,33 +1,33 @@
-/*
- * 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.openmeetings.screenshare;
-
-import java.io.IOException;
-
-import org.red5.server.net.rtmp.event.VideoData;
-
-public interface IScreenEncoder {
- void createUnalteredFrame() throws IOException;
-
- VideoData getUnalteredFrame();
-
- VideoData encode(int[][] img) throws IOException;
-
- void reset();
-}
+/*
+ * 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.openmeetings.screenshare;
+
+import java.io.IOException;
+
+import org.red5.server.net.rtmp.event.VideoData;
+
+public interface IScreenEncoder {
+ void createUnalteredFrame() throws IOException;
+
+ VideoData getUnalteredFrame();
+
+ VideoData encode(int[][] img) throws IOException;
+
+ void reset();
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java
----------------------------------------------------------------------
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java
index 598f9fd2..7e44ba3 100644
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java
+++ b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java
@@ -1,103 +1,103 @@
-/*
- * 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.openmeetings.screenshare;
-
-import org.red5.client.net.rtmp.INetStreamEventHandler;
-import org.red5.client.net.rtmp.RTMPClient;
-import org.red5.server.api.service.IPendingServiceCall;
-import org.red5.server.api.service.IPendingServiceCallback;
-import org.red5.server.net.ICommand;
-import org.red5.server.net.rtmp.Channel;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.event.Notify;
-import org.red5.server.net.rtmp.message.Header;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class RTMPClientPublish extends RTMPClient implements IPendingServiceCallback, INetStreamEventHandler, IScreenShare {
- private static final Logger logger = LoggerFactory.getLogger(RTMPClientPublish.class);
- private final CaptureScreen publishScreen;
- private String id;
- private Core core;
-
- public void setCore(Core core) {
- this.core = core;
- }
-
- RTMPClientPublish(Core core, String host, String app, String id) {
- this.id = id;
- this.core = core;
- publishScreen = new CaptureScreen(core, this, host, app, 1935);
- }
-
- public void connect() {
- super.connect(publishScreen.getHost(), 1935, publishScreen.getApp(), this);
- }
-
- @Override
- public void handleException(Throwable throwable) {
- logger.error("ERROR", throwable);
- }
-
- @Override
- public void connectionOpened(RTMPConnection conn) {
- super.connectionOpened(conn);
- createStream(this);
- }
-
- @Override
- public void connectionClosed(RTMPConnection conn) {
- super.connectionClosed(conn);
- connectionClosed();
- }
-
- private void connectionClosed() {
- publishScreen.setStartPublish(false);
- publishScreen.release();
- core.publishingStop();
- }
-
- @Override
- protected void onCommand(RTMPConnection conn, Channel channel, Header source, ICommand command) {
- super.onCommand(conn, channel, source, command);
- }
-
- @Override
- public void resultReceived(IPendingServiceCall call) {
- String method = call == null ? null : call.getServiceMethodName();
- logger.trace("call ### get Method Name " + method);
- if ("connect".equals(method)) {
- //setConnectionAsSharingClient(); //FIXME
- } else if ("createStream".equals(method)) {
- if (call.getResult() != null) {
- publishScreen.setStreamId((Integer)call.getResult());
- publish(publishScreen.getStreamId(), id, "live", this);
- publishScreen.setStartPublish(true);
- publishScreen.start();
- } else {
- connectionClosed();
- }
- }
- }
-
- @Override
- public void onStreamEvent(Notify notify) {
- //no-op
- }
+/*
+ * 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.openmeetings.screenshare;
+
+import org.red5.client.net.rtmp.INetStreamEventHandler;
+import org.red5.client.net.rtmp.RTMPClient;
+import org.red5.server.api.service.IPendingServiceCall;
+import org.red5.server.api.service.IPendingServiceCallback;
+import org.red5.server.net.ICommand;
+import org.red5.server.net.rtmp.Channel;
+import org.red5.server.net.rtmp.RTMPConnection;
+import org.red5.server.net.rtmp.event.Notify;
+import org.red5.server.net.rtmp.message.Header;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class RTMPClientPublish extends RTMPClient implements IPendingServiceCallback, INetStreamEventHandler, IScreenShare {
+ private static final Logger logger = LoggerFactory.getLogger(RTMPClientPublish.class);
+ private final CaptureScreen publishScreen;
+ private String id;
+ private Core core;
+
+ public void setCore(Core core) {
+ this.core = core;
+ }
+
+ RTMPClientPublish(Core core, String host, String app, String id) {
+ this.id = id;
+ this.core = core;
+ publishScreen = new CaptureScreen(core, this, host, app, 1935);
+ }
+
+ public void connect() {
+ super.connect(publishScreen.getHost(), 1935, publishScreen.getApp(), this);
+ }
+
+ @Override
+ public void handleException(Throwable throwable) {
+ logger.error("ERROR", throwable);
+ }
+
+ @Override
+ public void connectionOpened(RTMPConnection conn) {
+ super.connectionOpened(conn);
+ createStream(this);
+ }
+
+ @Override
+ public void connectionClosed(RTMPConnection conn) {
+ super.connectionClosed(conn);
+ connectionClosed();
+ }
+
+ private void connectionClosed() {
+ publishScreen.setStartPublish(false);
+ publishScreen.release();
+ core.publishingStop();
+ }
+
+ @Override
+ protected void onCommand(RTMPConnection conn, Channel channel, Header source, ICommand command) {
+ super.onCommand(conn, channel, source, command);
+ }
+
+ @Override
+ public void resultReceived(IPendingServiceCall call) {
+ String method = call == null ? null : call.getServiceMethodName();
+ logger.trace("call ### get Method Name " + method);
+ if ("connect".equals(method)) {
+ //setConnectionAsSharingClient(); //FIXME
+ } else if ("createStream".equals(method)) {
+ if (call.getResult() != null) {
+ publishScreen.setStreamId((Integer)call.getResult());
+ publish(publishScreen.getStreamId(), id, "live", this);
+ publishScreen.setStartPublish(true);
+ publishScreen.start();
+ } else {
+ connectionClosed();
+ }
+ }
+ }
+
+ @Override
+ public void onStreamEvent(Notify notify) {
+ //no-op
+ }
}
\ No newline at end of file