[vlma-devel] commit: Helpers for removing and adding adapters to servers. (Adrien Grand )

git version control git at videolan.org
Sun Aug 24 01:34:44 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Aug 24 00:19:52 2008 +0200| [9af78d289fa8f5d86b60458dfb4f648b37749eb1] | committer: Adrien Grand 

Helpers for removing and adding adapters to servers.

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

 .../org/videolan/vlma/model/adapter/Server.java    |   18 ++++++++++++++++++
 .../web/server/ServerAdapterAddController.java     |    2 +-
 .../vlma/web/server/ServerAddController.java       |    4 ++--
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java b/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java
index 3dba089..c82b6f0 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java
@@ -86,6 +86,24 @@ public class Server implements Serializable {
     }
 
     /**
+     * Add an adapter to this server.
+     *
+     * @param adapter the adapter to add.
+     */
+    public void addAdapter(Adapter adapter) {
+        adapters.add(adapter);
+    }
+
+    /**
+     * Remove the provided adapter from this server.
+     *
+     * @param adapter the adapter to remove
+     */
+    public void removeAdapter(Adapter adapter) {
+        adapters.remove(adapter);
+    }
+
+    /**
      * Gives the server ID.
      *
      * @return the server ID
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAddController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAddController.java
index 7f66d56..789c837 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAddController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAdapterAddController.java
@@ -64,7 +64,7 @@ public class ServerAdapterAddController extends SimpleFormController {
         Adapter a = clazz.newInstance();
         a.setName(adapterName);
         a.setServer(server);
-        server.getAdapters().add(a);
+        server.addAdapter(a);
         if (a instanceof DVBSAdapter) {
             int satelliteId = ((ServerAdapterAdd) command).getSatellite();
             ((DVBSAdapter) a).setSatellite(data.getSatellite(satelliteId));
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 b9a021e..ca47365 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
@@ -65,8 +65,8 @@ public class ServerAddController extends SimpleFormController {
         streamAdapter.setServer(server);
         /* Add automatically the file-adapter and the stream-adapter
         when creating a new server. */
-        server.getAdapters().add(filesAdapter);
-        server.getAdapters().add(streamAdapter);
+        server.addAdapter(filesAdapter);
+        server.addAdapter(streamAdapter);
         data.add(server);
         return new ModelAndView(new RedirectView(getSuccessView()));
     }



More information about the vlma-devel mailing list