Revision: 16055
Author: oleg.kulikoff
Date: Sun Dec 26 05:47:07 2010
Log: Issue 1976: MediaObjectID robustness tests
http://code.google.com/p/mobicents/source/detail?r=16055
Added:
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/ParameterImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/AdapterConfig.java
Deleted:
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MediaMixerConfig.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAdapterConfig.java
Modified:
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MediaObjectImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MediaSessionImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MsControlFactoryImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/container/ContainerImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/MediaGroupImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerConfigImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerRecorderSignalDetectorConfig.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerSignalDetectorConfig.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/RecorderConfigImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/SignalDetectorConfig.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MediaMixerImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAdapterImpl.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAudioConfig.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/BaseConfig.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/CreateConnectionRequest.java
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/NetworkConnectionImpl.java
/trunk/servers/media/jsr-309/core/src/test/java/org/mobicents/javax/media/mscontrol/networkconnection/BaseConfigTest.java
=======================================
--- /dev/null
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/ParameterImpl.java
Sun Dec 26 05:47:07 2010
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * 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 General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but
WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+package org.mobicents.javax.media.mscontrol;
+
+import javax.media.mscontrol.Parameter;
+
+/**
+ *
+ * @author kulikov
+ */
+public class ParameterImpl implements Parameter {
+ private String name;
+
+ public static Parameter create(String name) {
+ return new ParameterImpl(name);
+ }
+
+ private ParameterImpl(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null) {
+ return false;
+ }
+
+ if (other == this) {
+ return true;
+ }
+
+ if (!(other instanceof ParameterImpl)) {
+ return false;
+ }
+
+ return ((ParameterImpl) other).name.equals(name);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 67 * hash + (this.name != null ? this.name.hashCode() : 0);
+ return hash;
+ }
+}
=======================================
--- /dev/null
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/AdapterConfig.java
Sun Dec 26 05:47:07 2010
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * 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 General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but
WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+package org.mobicents.javax.media.mscontrol.mixer;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.media.mscontrol.Configuration;
+import javax.media.mscontrol.EventType;
+import javax.media.mscontrol.MediaConfig;
+import javax.media.mscontrol.MediaObject;
+import javax.media.mscontrol.Parameter;
+import javax.media.mscontrol.Parameters;
+import javax.media.mscontrol.Qualifier;
+import javax.media.mscontrol.Value;
+import javax.media.mscontrol.resource.Action;
+import javax.media.mscontrol.resource.Trigger;
+import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.ParametersImpl;
+import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
+
+/**
+ *
+ * @author kulikov
+ */
+public class AdapterConfig implements Configuration {
+
+ private MediaConfigImpl config;
+ private Parameters params = new ParametersImpl();
+
+ protected AdapterConfig() {
+
+ //specify parameters
+ Set<Parameter> parameters = new HashSet();
+ parameters.add(MediaObject.MEDIAOBJECT_ID);
+
+ //specify event types
+ Set<EventType> eventTypes = new HashSet();
+
+ //Define actions
+ Set<Action> actions = new HashSet();
+
+ //Define qualifiers
+ Set<Qualifier> qualifiers = new HashSet();
+
+ //Define triggers
+ Set<Trigger> triggers = new HashSet();
+
+ //Define values
+ Set<Value> values = new HashSet();
+
+ params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/cnf/$");
+
+ SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
+ config = new MediaConfigImpl(features, params);
+ }
+
+ public MediaConfig getConfig() {
+ return config;
+ }
+
+}
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MediaMixerConfig.java
Mon Jan 25 10:19:53 2010
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.mobicents.javax.media.mscontrol.mixer;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.media.mscontrol.EventType;
-import javax.media.mscontrol.MediaObject;
-import javax.media.mscontrol.MediaSession;
-import javax.media.mscontrol.Parameter;
-import javax.media.mscontrol.Parameters;
-import javax.media.mscontrol.Qualifier;
-import javax.media.mscontrol.Value;
-import javax.media.mscontrol.mixer.MediaMixer;
-import javax.media.mscontrol.resource.Action;
-import javax.media.mscontrol.resource.Trigger;
-
-import org.mobicents.javax.media.mscontrol.MediaSessionImpl;
-import org.mobicents.javax.media.mscontrol.ParametersImpl;
-import org.mobicents.javax.media.mscontrol.resource.ExtendedParameter;
-
-/**
- *
- * @author amit bhayani
- *
- */
-public class MediaMixerConfig {
-
- private final ParametersImpl parametersImpl;
- private final Set<EventType> eventTypes;
- private final Set<Qualifier> qualifiers;
- private final Set<Trigger> triggers;
- private final Set<Value> values;
- private final Set<Action> actions;
-
- private MediaMixerConfig(boolean clone) {
- parametersImpl = new ParametersImpl();
- eventTypes = new HashSet<EventType>();
- qualifiers = new HashSet<Qualifier>();
- triggers = new HashSet<Trigger>();
- values = new HashSet<Value>();
- actions = new HashSet<Action>();
- }
-
- public MediaMixerConfig() {
-
- this.parametersImpl = new ParametersImpl();
-
this.parametersImpl.put(ExtendedParameter.ENDPOINT_LOCAL_NAME, "/mobicents/media/cnf/$");
- this.parametersImpl.put(MediaMixer.MAX_PORTS, 5);
- this.parametersImpl.put(MediaObject.MEDIAOBJECT_ID,
Parameters.NO_PARAMETER);
- this.parametersImpl.put(MediaSession.TIMEOUT,
MediaSessionImpl.SESSION_TIMEOUT);
-
- eventTypes = new HashSet<EventType>();
-
- qualifiers = new HashSet<Qualifier>();
-
- triggers = new HashSet<Trigger>();
-
- values = new HashSet<Value>();
-
- actions = new HashSet<Action>();
- }
-
- protected ParametersImpl getParametersImpl() {
- ParametersImpl newparams = new ParametersImpl();
- newparams.putAll(this.parametersImpl);
- return newparams;
- }
-
- protected void setParametersImpl(Parameters params) {
- for (Parameter p : params.keySet()) {
- for (Parameter actual : this.parametersImpl.keySet()) {
- if (p == actual) {
- this.parametersImpl.put(actual,
params.get(actual));
- }
- }
- }
- }
-
- public Set<Parameter> getParameters() {
- return parametersImpl.keySet();
- }
-
- public Set<EventType> getEventTypes() {
- return eventTypes;
- }
-
- public Set<Qualifier> getQualifiers() {
- return qualifiers;
- }
-
- public Set<Trigger> getTriggers() {
- return triggers;
- }
-
- public Set<Value> getValues() {
- return values;
- }
-
- public Set<Action> getActions() {
- return actions;
- }
-
- public MediaMixerConfig createCustomizedClone(Parameters params) {
- MediaMixerConfig clone = new MediaMixerConfig(true);
- clone.parametersImpl.putAll(this.parametersImpl);
- clone.eventTypes.addAll(this.eventTypes);
- clone.qualifiers.addAll(this.qualifiers);
- clone.triggers.addAll(this.triggers);
- clone.values.addAll(this.values);
- clone.actions.addAll(this.actions);
-
- if (params != null && params != Parameters.NO_PARAMETER) {
- for (Parameter p : clone.parametersImpl.keySet()) {
- for (Parameter pArg : params.keySet()) {
- if (p == pArg) {
- clone.parametersImpl.put(pArg,
params.get(pArg));
- }
- }
- }
- }
-
- return clone;
- }
-
-}
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAdapterConfig.java
Sun Mar 21 20:56:02 2010
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.mobicents.javax.media.mscontrol.mixer;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.media.mscontrol.EventType;
-import javax.media.mscontrol.MediaObject;
-import javax.media.mscontrol.Parameter;
-import javax.media.mscontrol.Parameters;
-import javax.media.mscontrol.Qualifier;
-import javax.media.mscontrol.Value;
-import javax.media.mscontrol.resource.Action;
-import javax.media.mscontrol.resource.Trigger;
-
-import org.mobicents.javax.media.mscontrol.ParametersImpl;
-import org.mobicents.javax.media.mscontrol.resource.ExtendedParameter;
-
-public class MixerAdapterConfig {
-
- private final ParametersImpl parametersImpl;
- private final Set<EventType> eventTypes;
- private final Set<Qualifier> qualifiers;
- private final Set<Trigger> triggers;
- private final Set<Value> values;
- private final Set<Action> actions;
- private final String config;
-
- public MixerAdapterConfig(boolean clone, String config) {
- this.config = config;
- parametersImpl = new ParametersImpl();
- eventTypes = new HashSet<EventType>();
- qualifiers = new HashSet<Qualifier>();
- triggers = new HashSet<Trigger>();
- values = new HashSet<Value>();
- actions = new HashSet<Action>();
-
- }
-
- public MixerAdapterConfig(String config) {
- this.config = config;
- parametersImpl = new ParametersImpl();
- this.parametersImpl.put(MediaObject.MEDIAOBJECT_ID,
Parameters.NO_PARAMETER);
- this.parametersImpl.put(ExtendedParameter.MIXER_ADAPTER_CONFIG,
config);
-
- eventTypes = new HashSet<EventType>();
- qualifiers = new HashSet<Qualifier>();
- triggers = new HashSet<Trigger>();
- values = new HashSet<Value>();
- actions = new HashSet<Action>();
-
- }
-
- protected ParametersImpl getParametersImpl() {
- ParametersImpl newparams = new ParametersImpl();
- newparams.putAll(this.parametersImpl);
- return newparams;
- }
-
- protected void setParametersImpl(Parameters params) {
- for (Parameter p : params.keySet()) {
- for (Parameter actual : this.parametersImpl.keySet()) {
- if (p == actual) {
- this.parametersImpl.put(actual,
params.get(actual));
- }
- }
- }
- }
-
- public Set<Parameter> getParameters() {
- return parametersImpl.keySet();
- }
-
- public Set<EventType> getEventTypes() {
- return eventTypes;
- }
-
- public Set<Qualifier> getQualifiers() {
- return qualifiers;
- }
-
- public Set<Trigger> getTriggers() {
- return triggers;
- }
-
- public Set<Value> getValues() {
- return values;
- }
-
- public Set<Action> getActions() {
- return actions;
- }
-
- public MixerAdapterConfig createCustomizedClone(Parameters params) {
-
- MixerAdapterConfig clone = new MixerAdapterConfig(true,
this.config);
- clone.parametersImpl.putAll(this.parametersImpl);
- clone.eventTypes.addAll(this.eventTypes);
- clone.qualifiers.addAll(this.qualifiers);
- clone.triggers.addAll(this.triggers);
- clone.values.addAll(this.values);
- clone.actions.addAll(this.actions);
-
- if (params != null && params != Parameters.NO_PARAMETER) {
- for (Parameter p : clone.parametersImpl.keySet()) {
- for (Parameter pArg : params.keySet()) {
- if (p == pArg) {
- clone.parametersImpl.put(pArg,
params.get(pArg));
- }
- }
- }
- }
-
- return clone;
- }
-}
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MediaObjectImpl.java
Sat Dec 25 21:50:00 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MediaObjectImpl.java
Sun Dec 26 05:47:07 2010
@@ -20,7 +20,9 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import javax.media.mscontrol.MediaObject;
+import javax.media.mscontrol.MsControlException;
import javax.media.mscontrol.Parameter;
import javax.media.mscontrol.Parameters;
import org.mobicents.javax.media.mscontrol.spi.DriverImpl;
@@ -30,7 +32,8 @@
* @author kulikov
*/
public abstract class MediaObjectImpl implements MediaObject {
-
+ public final static Parameter ENDPOINT_NAME =
ParameterImpl.create("ENDPOINT_NAME");
+
private static int GENERATOR = 0;
private URI uri;
@@ -39,7 +42,9 @@
private Parameters parameters = new ParametersImpl();
- public MediaObjectImpl(MediaObject parent, DriverImpl driver,
Parameters parameters) {
+ private ArrayList<String> IDs = new ArrayList();
+
+ public MediaObjectImpl(MediaObjectImpl parent, DriverImpl driver,
Parameters parameters) throws MsControlException {
this.parent = parent;
this.driver = driver;
@@ -56,24 +61,41 @@
objectName = objectName.substring(0, objectName.length() - 4);
}
- String localName = null;
+ String objectID = null;
if (parameters != null) {
- localName = (String)parameters.get(MEDIAOBJECT_ID);
+ objectID = (String)parameters.get(MEDIAOBJECT_ID);
}
-
- if (localName == null) {
- localName = objectName + (++GENERATOR);
- }
-
- if (!localName.matches("([\\d]|[A-Z]|[a-z])([\\S]{0,})")) {
- throw new IllegalArgumentException("OBJECT_ID should start
from letter or digit");
+ //if not specified generate unique;
+ if (objectID == null) {
+ objectID = objectName + (++GENERATOR);
+ }
+
+ if (!Character.isLetterOrDigit(objectID.charAt(0)) &&
objectID.charAt(0) != '/') {
+ throw new MsControlException("Illegal MEDIAOBJECT_ID: " +
objectID);
+ }
+
+ if (parent != null && parent.IDs.contains(objectID)) {
+ throw new MsControlException("MEDIAOBJECT_ID must be unique: "
+ objectID);
}
+ String localName = null;
+ if (parameters != null) {
+ localName = (String)parameters.get(ENDPOINT_NAME);
+ }
+
+ if (localName == null) {
+ localName = objectID;
+ }
+
try {
- uri = new URI(prefix + "/" + localName);
+ uri = new URI(prefix + "/" + objectID);
} catch (URISyntaxException e) {
}
+
+ if (parent != null) {
+ parent.IDs.add(objectID);
+ }
}
public URI getURI() {
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MediaSessionImpl.java
Sat Dec 25 21:46:08 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MediaSessionImpl.java
Sun Dec 26 05:47:07 2010
@@ -51,7 +51,7 @@
private static int reqID;
- public MediaSessionImpl(MsControlFactoryImpl factory) {
+ public MediaSessionImpl(MsControlFactoryImpl factory) throws
MsControlException {
super(null, factory.getDriver(), null);
this.factory = factory;
@@ -81,6 +81,10 @@
}
public MediaGroup createMediaGroup(Configuration<MediaGroup> pattern)
throws MsControlException {
+ if (pattern == null) {
+ throw new MsControlException("Configuration is NULL");
+ }
+
MediaConfigImpl config = (MediaConfigImpl)
factory.getMediaConfig(pattern);
if (config == null) {
throw new MsControlException("Configuration is not
supported: " + pattern);
@@ -91,6 +95,10 @@
}
public MediaGroup createMediaGroup(Configuration<MediaGroup> pattern,
Parameters params) throws MsControlException {
+ if (pattern == null) {
+ throw new MsControlException("Configuration is NULL");
+ }
+
MediaConfigImpl config = (MediaConfigImpl)
factory.getMediaConfig(pattern);
if (config == null) {
throw new MsControlException("Configuration is not
supported: " + pattern);
@@ -108,6 +116,10 @@
}
public MediaMixer createMediaMixer(Configuration<MediaMixer> pattern)
throws MsControlException {
+ if (pattern == null) {
+ throw new MsControlException("Configuration is NULL");
+ }
+
MediaConfigImpl config = (MediaConfigImpl)
factory.getMediaConfig(pattern);
if (config == null) {
throw new MsControlException("Configuration is not
supported: " + pattern);
@@ -118,6 +130,10 @@
}
public MediaMixer createMediaMixer(Configuration<MediaMixer> pattern,
Parameters params) throws MsControlException {
+ if (pattern == null) {
+ throw new MsControlException("Configuration is NULL");
+ }
+
MediaConfigImpl config = (MediaConfigImpl)
factory.getMediaConfig(pattern);
if (config == null) {
@@ -138,6 +154,10 @@
}
public NetworkConnection
createNetworkConnection(Configuration<NetworkConnection> pattern) throws
MsControlException {
+ if (pattern == null) {
+ throw new MsControlException("Configuration is NULL");
+ }
+
//construsting network configuration from pattern
MediaConfigImpl config = null;
if (pattern == NetworkConnection.BASIC) {
@@ -154,6 +174,10 @@
}
public NetworkConnection
createNetworkConnection(Configuration<NetworkConnection> pattern,
Parameters params) throws MsControlException {
+ if (pattern == null) {
+ throw new MsControlException("Configuration is NULL");
+ }
+
//construsting network configuration from pattern
MediaConfigImpl config = null;
if (pattern == NetworkConnection.BASIC) {
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MsControlFactoryImpl.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/MsControlFactoryImpl.java
Sun Dec 26 05:47:07 2010
@@ -12,6 +12,7 @@
import javax.media.mscontrol.MediaConfigException;
import javax.media.mscontrol.MediaObject;
import javax.media.mscontrol.MediaSession;
+import javax.media.mscontrol.MsControlException;
import javax.media.mscontrol.MsControlFactory;
import javax.media.mscontrol.Parameters;
import javax.media.mscontrol.mediagroup.MediaGroup;
@@ -58,7 +59,6 @@
}
public MediaSession createMediaSession() {
- System.out.println("===== Create Session====");
lock.lock();
try {
//create new media session and put into the list of active
sessions
@@ -67,6 +67,8 @@
//return result
return session;
+ } catch (MsControlException e){
+ return null;
} finally {
lock.unlock();
}
@@ -120,7 +122,7 @@
return MediaGroupImpl.PLAYER_RECORDER_SIGNAL_DETECTOR_CONFIG;
} else if (cfg.equals(MediaMixer.AUDIO)) {
return MediaMixerImpl.AUDIO_CONFIG;
- }
+ }
throw new MediaConfigException("Unsupported Configuration " + cfg);
}
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/container/ContainerImpl.java
Sat Dec 25 07:16:26 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/container/ContainerImpl.java
Sun Dec 26 05:47:07 2010
@@ -39,7 +39,7 @@
private InvocationLock invocationLock = new InvocationLock();
- public ContainerImpl(MediaSessionImpl session, Parameters parameters) {
+ public ContainerImpl(MediaSessionImpl session, Parameters parameters)
throws MsControlException {
super(session, session.getDriver(), parameters);
this.session = session;
listeners.add(invocationLock);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/MediaGroupImpl.java
Sat Dec 25 21:51:00 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/MediaGroupImpl.java
Sun Dec 26 05:47:07 2010
@@ -66,7 +66,7 @@
public MediaGroupImpl(MediaSessionImpl session, MediaConfigImpl
config) throws MsControlException {
super(session, config.getParameters());
//determine endpoint local name
- String localName = (String)config.getValue(MEDIAOBJECT_ID);
+ String localName = (String)config.getValue(ENDPOINT_NAME);
//domain name of the server is constructed using proprties from
config
String domainName = session.getDriver().getRemoteDomainName();
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerConfigImpl.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerConfigImpl.java
Sun Dec 26 05:47:07 2010
@@ -33,6 +33,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -81,7 +82,7 @@
values.add(Player.QUEUE_IF_BUSY);
values.add(Player.STOP_IF_BUSY);
- params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/IVR/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/IVR/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerRecorderSignalDetectorConfig.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerRecorderSignalDetectorConfig.java
Sun Dec 26 05:47:07 2010
@@ -37,6 +37,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -121,7 +122,7 @@
values.add(Recorder.DETECT_ALL_OCCURRENCES);
values.add(Recorder.DETECT_FIRST_OCCURRENCE);
- params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/IVR/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/IVR/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerSignalDetectorConfig.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/PlayerSignalDetectorConfig.java
Sun Dec 26 05:47:07 2010
@@ -35,6 +35,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -108,7 +109,7 @@
values.add(Player.QUEUE_IF_BUSY);
values.add(Player.STOP_IF_BUSY);
- params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/IVR/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/IVR/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/RecorderConfigImpl.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/RecorderConfigImpl.java
Sun Dec 26 05:47:07 2010
@@ -33,6 +33,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -77,7 +78,7 @@
values.add(Recorder.DETECT_ALL_OCCURRENCES);
values.add(Recorder.DETECT_FIRST_OCCURRENCE);
- params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/IVR/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/IVR/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/SignalDetectorConfig.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mediagroup/SignalDetectorConfig.java
Sun Dec 26 05:47:07 2010
@@ -33,6 +33,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -91,7 +92,7 @@
//Define values
Set<Value> values = new HashSet();
- params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/IVR/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/IVR/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MediaMixerImpl.java
Fri Dec 24 02:58:35 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MediaMixerImpl.java
Sun Dec 26 05:47:07 2010
@@ -39,50 +39,40 @@
this.config = config;
}
- public MixerAdapter createMixerAdapter(Configuration<MixerAdapter>
paramConfiguration) throws MsControlException {
-
- /* if (paramConfiguration == null) {
- throw new MsControlException("Configuration<MixerAdapter> cannot
be null");
+ public MixerAdapter createMixerAdapter(Configuration<MixerAdapter>
config) throws MsControlException {
+ if (config == null) {
+ throw new MsControlException("Configuration is NULL");
}
- MediaConfigImpl config = (MediaConfigImpl)
this.session.getMsControlFactoryImpl().getMediaConfig(
- paramConfiguration);
- MixerAdapter mixerAdapter = new MixerAdapterImpl(this,
this.session, config, null);
- adaptors.add(mixerAdapter);
- return mixerAdapter;
- */
- return null;
+
+ MixerAdapterImpl adaptor = new
MixerAdapterImpl(this,(MediaConfigImpl) config);
+ adaptors.add(adaptor);
+ return adaptor;
+
}
- public MixerAdapter createMixerAdapter(Configuration<MixerAdapter>
paramConfiguration, Parameters paramParameters)
- throws MsControlException {
- if (paramConfiguration == null) {
- throw new MsControlException("Configuration<MixerAdapter>
cannot be null");
- }
-
- /* MediaConfigImpl config = (MediaConfigImpl)
this.session.getMsControlFactoryImpl().getMediaConfig(
- paramConfiguration);
- MixerAdapter mixerAdapter = new MixerAdapterImpl(this,
this.session, config,
- paramParameters);
- adaptors.add(mixerAdapter);
- return mixerAdapter;
- */
- return null;
+ public MixerAdapter createMixerAdapter(Configuration<MixerAdapter>
pattern, Parameters param) throws MsControlException {
+ if (config == null) {
+ throw new MsControlException("Configuration can't be null");
+ }
+
+ MediaConfigImpl cfg = (MediaConfigImpl)
getConfiguration(pattern).createCustomizedClone(param);
+
+ MixerAdapterImpl adaptor = new
MixerAdapterImpl(this,(MediaConfigImpl) cfg);
+ adaptors.add(adaptor);
+ return adaptor;
}
- public MixerAdapter createMixerAdapter(MediaConfig paramMediaConfig,
Parameters paramParameters)
- throws MsControlException {
- if (paramMediaConfig == null) {
+ public MixerAdapter createMixerAdapter(MediaConfig config, Parameters
params) throws MsControlException {
+ if (config == null) {
throw new MsControlException("MediaConfig cannot be null");
}
- /*
- MixerAdapter mixerAdapter = new MixerAdapterImpl(this,
this.session,
- (MediaConfigImpl) paramMediaConfig, paramParameters);
- adaptors.add(mixerAdapter);
- return mixerAdapter;
- */
- return null;
-
+
+ MediaConfig cfg =
((MediaConfigImpl)config).createCustomizedClone(params);
+
+ MixerAdapterImpl adaptor = new
MixerAdapterImpl(this,(MediaConfigImpl) cfg);
+ adaptors.add(adaptor);
+ return adaptor;
}
public void confirm() throws MsControlException {
@@ -135,4 +125,11 @@
public void triggerAction(Action arg0) {
// TODO Auto-generated method stub
}
-}
+
+ public MediaConfig getConfiguration(Configuration pattern) {
+ if (pattern.equals(MixerAdapter.DTMF_CLAMP)) {
+ return MixerAdapterImpl.ADAPTOR_CFG;
+ }
+ return null;
+ }
+}
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAdapterImpl.java
Fri Dec 24 02:58:35 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAdapterImpl.java
Sun Dec 26 05:47:07 2010
@@ -1,116 +1,65 @@
package org.mobicents.javax.media.mscontrol.mixer;
-
-import java.net.URI;
import java.util.Iterator;
import javax.media.mscontrol.MediaConfig;
import javax.media.mscontrol.MediaObject;
import javax.media.mscontrol.MsControlException;
-import javax.media.mscontrol.Parameters;
import javax.media.mscontrol.mixer.MixerAdapter;
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.AllocationEventListener;
-import org.apache.log4j.Logger;
import org.mobicents.javax.media.mscontrol.container.ContainerImpl;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
-import org.mobicents.javax.media.mscontrol.MediaSessionImpl;
public class MixerAdapterImpl extends ContainerImpl implements
MixerAdapter {
-
- public static Logger logger = Logger.getLogger(MixerAdapterImpl.class);
-
- private URI uri = null;
- private final MediaMixerImpl mediaMixerImpl;
- private Parameters parameters = null;
-
- public MixerAdapterImpl(MediaMixerImpl mediaMixerImpl, MediaSessionImpl
mediaSession,
- MediaConfigImpl config, Parameters params) throws
MsControlException {
- super(mediaSession, null);
- this.config = config;
- this.mediaMixerImpl = mediaMixerImpl;
-/* this.mixAdapterConfig = ((SupportedFeaturesImpl)
this.config.getSupportedFeatures()).getMixAdaConfig()
- .createCustomizedClone(params);
-
- this.parameters = this.mixAdapterConfig.getParametersImpl();
-
- String passedId = (String) this.parameters.get(MEDIAOBJECT_ID);
- if (passedId != null) {
-
- if (!Character.isLetterOrDigit(passedId.charAt(0))) {
- throw new MsControlException(
- "MEDIAOBJECT_ID should start with letter or digit. Invalid first
character for passed MEDIAOBJECT_ID = "
- + passedId);
- }
-
- for (MixerAdapter mixAda :
this.mediaMixerImpl.adaptors) {
- if (((ContainerImpl)
mixAda).getId().compareTo(passedId) == 0) {
- throw new MsControlException("Duplicate MEDIAOBJECT_ID = " +
passedId);
- }
- }
- this.id = passedId;
- }
-
- try {
- this.uri = new URI(mediaSession.getURI().toString() + "/MediaMixer." +
this.id);
- } catch (URISyntaxException e) {
- // Ignore
- }
- */
- }
-
-
- @Override
- public URI getURI() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void confirm() throws MsControlException {
- // TODO Auto-generated method stub
-
- }
-
- public MediaConfig getConfig() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public <R> R getResource(Class<R> arg0) throws MsControlException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void triggerAction(Action arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public Iterator<MediaObject> getMediaObjects() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public <T extends MediaObject> Iterator<T> getMediaObjects(Class<T> arg0)
{
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public void release() {
- this.mediaMixerImpl.adaptors.remove(this);
- }
-
-
- public void addListener(AllocationEventListener arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void removeListener(AllocationEventListener arg0) {
- // TODO Auto-generated method stub
-
- }
-
-}
+ public static MediaConfig ADAPTOR_CFG = new
AdapterConfig().getConfig();
+
+ private final MediaMixerImpl mixer;
+
+ public MixerAdapterImpl(MediaMixerImpl mixer, MediaConfigImpl config)
throws MsControlException {
+ super(mixer.getMediaSession(), config.getParameters());
+ this.config = config;
+ this.mixer = mixer;
+ }
+
+ public void confirm() throws MsControlException {
+ // TODO Auto-generated method stub
+ }
+
+ public MediaConfig getConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <R> R getResource(Class<R> arg0) throws MsControlException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void triggerAction(Action arg0) {
+ // TODO Auto-generated method stub
+ }
+
+ public Iterator<MediaObject> getMediaObjects() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends MediaObject> Iterator<T> getMediaObjects(Class<T>
arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void release() {
+ this.mixer.adaptors.remove(this);
+ }
+
+ public void addListener(AllocationEventListener arg0) {
+ // TODO Auto-generated method stub
+ }
+
+ public void removeListener(AllocationEventListener arg0) {
+ // TODO Auto-generated method stub
+ }
+}
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAudioConfig.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/mixer/MixerAudioConfig.java
Sun Dec 26 05:47:07 2010
@@ -33,6 +33,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -71,7 +72,7 @@
//Define values
Set<Value> values = new HashSet();
- params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/cnf/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/cnf/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/BaseConfig.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/BaseConfig.java
Sun Dec 26 05:47:07 2010
@@ -32,6 +32,7 @@
import javax.media.mscontrol.resource.Action;
import javax.media.mscontrol.resource.Trigger;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import org.mobicents.javax.media.mscontrol.ParametersImpl;
import org.mobicents.javax.media.mscontrol.SupportedFeaturesImpl;
@@ -69,7 +70,7 @@
//Define values
Set<Value> values = new HashSet();
-
params.put(MediaObject.MEDIAOBJECT_ID, "/mobicents/media/packetrelay/$");
+
params.put(MediaObjectImpl.ENDPOINT_NAME, "/mobicents/media/packetrelay/$");
SupportedFeaturesImpl features = new
SupportedFeaturesImpl(parameters, actions, eventTypes, qualifiers,
triggers, values);
config = new MediaConfigImpl(features, params);
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/CreateConnectionRequest.java
Sat Dec 25 06:54:07 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/CreateConnectionRequest.java
Sun Dec 26 05:47:07 2010
@@ -41,7 +41,7 @@
//prepear callID and endpointID parameters for request
CallIdentifier callId = connection.getMediaSession().getCallID();
EndpointIdentifier endpointID = connection.getEndpoint();
-
+ System.out.println("ENDPOINT " + endpointID);
//ask for new unique transaction handler
int txHandle = connection.getMediaSession().getUniqueHandler();
=======================================
---
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/NetworkConnectionImpl.java
Sat Dec 25 06:54:07 2010
+++
/trunk/servers/media/jsr-309/core/src/main/java/org/mobicents/javax/media/mscontrol/networkconnection/NetworkConnectionImpl.java
Sun Dec 26 05:47:07 2010
@@ -57,7 +57,7 @@
this.config = config;
//determine endpoint local name
- String localName = (String)config.getValue(MEDIAOBJECT_ID);
+ String localName = (String)config.getValue(ENDPOINT_NAME);
//domain name of the server is constructed using proprties from
config
String domainName = session.getDriver().getRemoteDomainName();
=======================================
---
/trunk/servers/media/jsr-309/core/src/test/java/org/mobicents/javax/media/mscontrol/networkconnection/BaseConfigTest.java
Mon Dec 13 22:41:11 2010
+++
/trunk/servers/media/jsr-309/core/src/test/java/org/mobicents/javax/media/mscontrol/networkconnection/BaseConfigTest.java
Sun Dec 26 05:47:07 2010
@@ -12,6 +12,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.mobicents.javax.media.mscontrol.MediaConfigImpl;
+import org.mobicents.javax.media.mscontrol.MediaObjectImpl;
import static org.junit.Assert.*;
/**
@@ -45,7 +46,7 @@
@Test
public void testGetConfig() {
MediaConfigImpl c = (MediaConfigImpl)
NetworkConnectionImpl.BASE_CONFIG;
- String endpoint = (String) c.getValue(MediaObject.MEDIAOBJECT_ID);
+ String endpoint = (String)
c.getValue(MediaObjectImpl.ENDPOINT_NAME);
assertEquals("/mobicents/media/packetrelay/$", endpoint);
}