[vlma-devel] commit: - Make transparent the use of FilesAdapters and StreamAdapters. ( Adrien Maglo )

git version control git at videolan.org
Mon Jun 9 23:19:56 CEST 2008


vlma | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Jun  9 23:21:36 2008 +0200| [e1b7f25b93f4669b85c0da7087b2e67a7f99087d]

- Make transparent the use of FilesAdapters and StreamAdapters.
- Add automatically one adapter of each of this two types when adding a server.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=e1b7f25b93f4669b85c0da7087b2e67a7f99087d
---

 .../videolan/vlma/web/server/ServerAdapterAdd.java |    4 ----
 .../vlma/web/server/ServerAddController.java       |   10 +++++++++-
 .../WEB-INF/jsp/server/serveradapteradd_right.jsp  |    2 --
 .../webapp/WEB-INF/jsp/server/serverview_right.jsp |    6 ------
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAdd.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAdd.java
index 10322d0..12cace5 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAdd.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAdd.java
@@ -71,10 +71,6 @@ public class ServerAdapterAdd {
             return org.videolan.vlma.model.adapter.DVBSAdapter.class.getName();
         } else if (type.equals("DVB-T")) {
             return org.videolan.vlma.model.adapter.DVBTAdapter.class.getName();
-        } else if (type.equals("Files-Adapter")) {
-            return org.videolan.vlma.model.adapter.FilesAdapter.class.getName();
-        } else if (type.equals("Stream-Adapter")) {
-            return org.videolan.vlma.model.adapter.StreamAdapter.class.getName();
         }
         return type;
     }
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddController.java
index f97c94f..02e40e1 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddController.java
@@ -32,6 +32,9 @@ import org.springframework.web.servlet.mvc.SimpleFormController;
 import org.springframework.web.servlet.view.RedirectView;
 import org.videolan.vlma.Data;
 
+import org.videolan.vlma.model.adapter.FilesAdapter;
+import org.videolan.vlma.model.adapter.StreamAdapter;
+
 public class ServerAddController extends SimpleFormController {
 
     private Data data;
@@ -46,12 +49,17 @@ public class ServerAddController extends SimpleFormController {
 
     @Override
     public ModelAndView onSubmit(Object command) throws ServletException,
-            UnknownHostException {
+            UnknownHostException, InstantiationException,
+            IllegalAccessException, ClassNotFoundException {
         String serverName = ((ServerAdd) command).getName();
         InetAddress serverAddress = InetAddress
                 .getByName(((ServerAdd) command).getAddress());
         int server = data.addServer(serverName);
         data.setServerIp(server, serverAddress);
+        /* Add automatically the file-adapter and the stream-adapter
+        when creating a new server. */
+        data.addAdapter(server, "files-adapter", FilesAdapter.class.getName());
+        data.addAdapter(server, "stream-adapter", StreamAdapter.class.getName());
         return new ModelAndView(new RedirectView(getSuccessView()));
     }
 
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serveradapteradd_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serveradapteradd_right.jsp
index b1e2a18..2859547 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serveradapteradd_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serveradapteradd_right.jsp
@@ -37,8 +37,6 @@ function toggleGetSatellite() {
                 <select name="type" id="getTypeSelect" onchange="toggleGetSatellite()">
                     <option>DVB-S</option>
                     <option>DVB-T</option>
-                    <option>Files-Adapter</option>
-                    <option>Stream-Adapter</option>
                 </select>
             </td>
             <td><span class="error"><c:out
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp
index c8455ee..b5758c7 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/server/serverview_right.jsp
@@ -21,12 +21,6 @@
                     <c:when test="${adapter.value.type == 'DVB-T'}">
                         <fmt:message key="servers.view.adapters.dvbt" />
                     </c:when>
-                    <c:when test="${adapter.value.type == 'Files-Adapter'}">
-                        <fmt:message key="servers.view.adapters.files-adapter" />
-                    </c:when>
-                    <c:when test="${adapter.value.type == 'Stream-Adapter'}">
-                        <fmt:message key="servers.view.adapters.stream-adapter" />
-                    </c:when>
                 </c:choose>
                 <c:url value="serveradapterremove.htm" var="adapterRemoveUrl">
                     <c:param name="server" value="${server.id}" />



More information about the vlma-devel mailing list