Revision: 7320
Author: oleg.kulikoff
Date: Wed Aug  5 05:10:49 2009
Log: Issue 756: Composite components
http://code.google.com/p/mobicents/source/detail?r=7320

Added:
/trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/server/spi/ResourceGroup.java
Modified:
/trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/ComponentFactory.java /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Format.java /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Inlet.java /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/MediaSink.java /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/MediaSource.java /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Outlet.java

=======================================
--- /dev/null
+++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/server/spi/ResourceGroup.java Wed Aug 5 05:10:49 2009
@@ -0,0 +1,40 @@
+/*
+ * Mobicents, Communications Middleware
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party
+ * contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ *
+ * Boston, MA  02110-1301  USA
+ */
+package org.mobicents.media.server.spi;
+
+import org.mobicents.media.Component;
+import org.mobicents.media.MediaSink;
+import org.mobicents.media.MediaSource;
+
+/**
+ *
+ * @author kulikov
+ */
+public interface ResourceGroup extends Component {
+    public MediaSink getSink();
+    public MediaSource getSource();
+}
=======================================
--- /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/ComponentFactory.java Thu Apr 16 09:28:23 2009 +++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/ComponentFactory.java Wed Aug 5 05:10:49 2009
@@ -28,6 +28,7 @@
 package org.mobicents.media;

 import org.mobicents.media.server.spi.Endpoint;
+import org.mobicents.media.server.spi.ResourceUnavailableException;

 /**
  * Acts as a factory of any media components.
@@ -41,5 +42,5 @@
      * @param endpoint the endpoint which creates this component.
      * @return new instance of the component.
      */
-    public Component newInstance(Endpoint endpoint);
-}
+ public Component newInstance(Endpoint endpoint) throws ResourceUnavailableException;
+}
=======================================
--- /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Format.java Tue Jan 6 06:09:44 2009 +++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Format.java Wed Aug 5 05:10:49 2009
@@ -26,6 +26,8 @@
private long encodingCode; // This is set during equals/matches comparisons via isSameEncoding. Allows for fast string comparisons.
     private int hash;

+    public final static Format ANY = new Format("ANY");
+
     public Format(String encoding) {
         this.encoding = encoding;
         hash = encoding.hashCode();
@@ -78,8 +80,16 @@
     public boolean matches(Format format) {
         if (format == null) {
             return false;
- //System.out.println("matches null? " + MediaCGUtils.formatToStr(this));
-        }
+        }
+
+        if (this == ANY) {
+            return true;
+        }
+
+        if (format == ANY) {
+            return true;
+        }
+
if (!FormatUtils.isOneAssignableFromTheOther(getClass(), format.getClass())) {
             return false;
         }
=======================================
--- /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Inlet.java Mon May 4 01:50:29 2009 +++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Inlet.java Wed Aug 5 05:10:49 2009
@@ -40,4 +40,8 @@
      * @return the reference to the media sink.
      */
     public MediaSink getInput();
-}
+
+    public void connect(MediaSource source);
+    public void disconnect(MediaSource source);
+
+}
=======================================
--- /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/MediaSink.java Thu Jul 23 21:21:32 2009 +++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/MediaSink.java Wed Aug 5 05:10:49 2009
@@ -1,15 +1,28 @@
 /*
- * Mobicents Media Gateway
+ * Mobicents, Communications Middleware
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party
+ * contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
  *
- * The source code contained in this file is in in the public domain.
- * It can be used in any project or product without prior permission,
- * license or royalty payments. There is  NO WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION,
- * THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
- * AND DATA ACCURACY.  We do not warrant or make any representations
- * regarding the use of the software or the  results thereof, including
- * but not limited to the correctness, accuracy, reliability or
- * usefulness of the software.
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ *
+ * Boston, MA  02110-1301  USA
  */

 package org.mobicents.media;
@@ -57,6 +70,27 @@
      */
     public void disconnect(MediaSource source);

+    /**
+ * Flags which indicates that multiple connections to this sink are allowed.
+     *
+     * @return true if multiple connections are allowed
+     */
+    public boolean isMultipleConnectionsAllowed();
+
+    /**
+     * Create connection between outlet and this sink.
+     *
+     * @param outlet the outlet to connect with
+     */
+    public void connect(Outlet outlet);
+
+    /**
+     * Disconnects specified outlet from this sink.
+     *
+     * @param outlet the outlet to disconnect.
+     */
+    public void disconnect(Outlet outlet);
+
     /**
      * This methos is called by media source when new media is available
      *
=======================================
--- /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/MediaSource.java Thu Jul 23 21:21:32 2009 +++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/MediaSource.java Wed Aug 5 05:10:49 2009
@@ -1,17 +1,29 @@
 /*
- * Mobicents Media Gateway
+ * Mobicents, Communications Middleware
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party
+ * contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
  *
- * The source code contained in this file is in in the public domain.
- * It can be used in any project or product without prior permission,
- * license or royalty payments. There is  NO WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION,
- * THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
- * AND DATA ACCURACY.  We do not warrant or make any representations
- * regarding the use of the software or the  results thereof, including
- * but not limited to the correctness, accuracy, reliability or
- * usefulness of the software.
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ *
+ * Boston, MA  02110-1301  USA
  */
-
 package org.mobicents.media;

 import org.mobicents.media.server.spi.Timer;
@@ -54,6 +66,28 @@
      */
     public void disconnect(MediaSink sink);

+
+    /**
+ * Flags which indicates that multiple connections to this sink are allowed.
+     *
+     * @return true if multiple connections are allowed
+     */
+    public boolean isMultipleConnectionsAllowed();
+
+    /**
+     * Connects this source with specified inlet.
+     *
+     * @param inlet the inlet to connect with.
+     */
+    public void connect(Inlet inlet);
+
+    /**
+     * Disconnects this source with specified inlet.
+     *
+     * @param inlet the inlet to disconnect from.
+     */
+    public void disconnect(Inlet inlet);
+
     /**
      * Get possible formats in which this source can stream media.
      *
=======================================
--- /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Outlet.java Mon May 4 01:50:29 2009 +++ /trunk/servers/media/core/server-spi/src/main/java/org/mobicents/media/Outlet.java Wed Aug 5 05:10:49 2009
@@ -40,4 +40,8 @@
      * @return the reference to the media source.
      */
     public MediaSource getOutput();
-}
+
+    public void connect(MediaSink sink);
+    public void disconnect(MediaSink sink);
+
+}

Reply via email to