[vlma-devel] commit: - rename setFilesChannelServer function which is now also useful for streamChannel services . (Adrien Maglo )

git version control git at videolan.org
Thu Jun 19 14:40:18 CEST 2008


vlma | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Jun 19 14:34:43 2008 +0200| [e92b3cce29928e93a335defcbe620dceda136b21]

- rename setFilesChannelServer function which is now also useful for streamChannel services.
- remove an unnecessary test.

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

 vlma-api/src/main/java/org/videolan/vlma/Data.java |    2 +-
 .../src/main/java/org/videolan/vlma/DataImpl.java  |    9 ++++++---
 .../web/media/file/FileChannelAddController.java   |    2 +-
 .../web/media/file/FileChannelEditController.java  |   16 +++++++---------
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/Data.java b/vlma-api/src/main/java/org/videolan/vlma/Data.java
index 8c820e9..c440a0c 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/Data.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/Data.java
@@ -332,7 +332,7 @@ public interface Data {
      * @param filesChannel the VlFilesChannel
      * @param server the server
      */
-    public void setFilesChannelServer(int filesChannel, String server);
+    public void setChannelServer(int channel, String server);
 
     /** Adds the stream URL to the StreamChannels
     *
diff --git a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
index 37f9d32..8a2c951 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
@@ -426,10 +426,13 @@ public class DataImpl implements Data {
         }
     }
 
-    synchronized public void setFilesChannelServer(int filesChannel, String server)
+    synchronized public void setChannelServer(int channel, String server)
         throws ServerDoesNotExistException {
-        Media m = getMedia(filesChannel);
-        ((FilesChannel)m).setServer(getServer(server));
+        Media m = getMedia(channel);
+        if (m.getClass() == FilesChannel.class)
+            ((FilesChannel)m).setServer(getServer(server));
+        else if (m.getClass() == StreamChannel.class)
+            ((StreamChannel)m).setServer(getServer(server));
     }
 
     synchronized public void setStreamChannelStreamURL(int streamChannel, String URL)
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelAddController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelAddController.java
index 910cb82..ca6e874 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelAddController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelAddController.java
@@ -56,7 +56,7 @@ public class FileChannelAddController extends SimpleFormController {
 
         data.addMedia(nvfilesChannel);
         data.setFilesChannelFilesList(nvfilesChannel.getId(), ((FileChannelAdd) command).getFiles());
-        data.setFilesChannelServer(nvfilesChannel.getId(), ((FileChannelAdd) command).getServer());
+        data.setChannelServer(nvfilesChannel.getId(), ((FileChannelAdd) command).getServer());
         data.sortMedias();
 
         return new ModelAndView(new RedirectView(getSuccessView()));
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java
index 0b0b43f..c5fc659 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/file/FileChannelEditController.java
@@ -56,7 +56,7 @@ public class FileChannelEditController extends SimpleFormController {
 
         FilesChannel filesChannel = (FilesChannel)data.getMedia(id);
         data.setFilesChannelFilesList(filesChannel.getId(), ((FileChannelAdd) command).getFiles());
-        data.setFilesChannelServer(filesChannel.getId(), ((FileChannelAdd) command).getServer());
+        data.setChannelServer(filesChannel.getId(), ((FileChannelAdd) command).getServer());
         data.sortMedias();
 
         return new ModelAndView(new RedirectView(getSuccessView()));
@@ -71,15 +71,13 @@ public class FileChannelEditController extends SimpleFormController {
         FileChannelAdd filesChannelsAdd = new FileChannelAdd();
         filesChannelsAdd.setId(id);
         filesChannelsAdd.setName(media.getName());
-        if (media.getClass() == FilesChannel.class) {
-            filesChannelsAdd.setServer(((FilesChannel)media).getServer().getName());
-
-            String filesList = new String();
-            for (String file : ((FilesChannel)media).getFiles()) {
-                filesList += file + "\n";
-            }
-            filesChannelsAdd.setFiles(filesList);
+        filesChannelsAdd.setServer(((FilesChannel)media).getServer().getName());
+
+        String filesList = new String();
+        for (String file : ((FilesChannel)media).getFiles()) {
+            filesList += file + "\n";
         }
+        filesChannelsAdd.setFiles(filesList);
 
         List<String> serversNames = new ArrayList<String>();
         for (Server server : data.getServers()) {



More information about the vlma-devel mailing list