📄 provider.java
字号:
return this.getGenProv().getName();
}
/**
* getState method comment.
*/
public int getState() {
int jtapiState = this.getGenProv().getState();
switch (jtapiState) {
case Provider.IN_SERVICE: {
return JccProvider.IN_SERVICE;
}
case Provider.OUT_OF_SERVICE: {
return JccProvider.OUT_OF_SERVICE;
}
case Provider.SHUTDOWN: {
return JccProvider.SHUTDOWN;
}
default: {
return JccProvider.OUT_OF_SERVICE;
}
}
}
/**
* removeCallListener method comment.
*/
public void removeCallListener(JccCallListener cl) {
// see if it is registered
Map clMap = this.getCallListeners();
CallListenerAdapter cla = (CallListenerAdapter)clMap.remove(cl);
if (cla == null)
return;
else {
// tell all Jtapi calls to remove the listener adapter
Iterator jtapiCallIt = this.getCallMap().keySet().iterator();
while (jtapiCallIt.hasNext()) {
((Call)jtapiCallIt.next()).removeCallListener(cla);
}
}
}
/**
* removeCallLoadControlListener method comment.
*/
public void removeCallLoadControlListener(CallLoadControlListener clcl) {
this.getLoadListeners().remove(clcl);
}
/**
* Remove the JCC ConnectionListener.
*/
public void removeConnectionListener(JccConnectionListener cl) {
this.removeCallListener(cl);
}
/**
* removeProviderListener method comment.
*/
public void removeProviderListener(JccProviderListener listener) {
this.getGenProv().removeProviderListener(new ProviderListenerAdapter(
this,
listener));
}
/**
* setCallLoadControl method comment.
*/
public void setCallLoadControl(JccAddress[] a1, double dur, double[] mech, int[] treat) throws javax.csapi.cc.jcc.MethodNotSupportedException {
String low = null;
String high = null;
double adRate = 0;
double interval = 0;
if (a1.length > 0)
low = a1[0].getName();
if (a1.length > 1)
high = a1[1].getName();
if (mech.length > 0)
adRate = mech[0];
if (mech.length > 1)
interval = mech[1];
try {
this.getGenProv().getRaw().setLoadControl(
low,
high,
dur,
adRate,
interval,
treat);
} catch (javax.telephony.MethodNotSupportedException mnse) {
throw new javax.csapi.cc.jcc.MethodNotSupportedException(mnse.getMessage());
}
}
/**
* Insert the method's description here.
* Creation date: (2000-10-10 12:36:45)
* @param newGenProv net.sourceforge.gjtapi.GenericProvider
*/
private void setGenProv(net.sourceforge.gjtapi.GenericProvider newGenProv) {
genProv = newGenProv;
}
/**
* shutdown method comment.
*/
public void shutdown() {
this.getGenProv().shutdown();
}
/**
This method returns a standard EventFilter which is implemented by the JCC platform.
For all events that require filtering by this {@link EventFilter}, apply the following:
<ul>
<li>If the mid call event type and value are matched and the connection's state (e.g. returned by
{@link JccConnection#getJccState()}) of the connection is {@link JccConnection#CONNECTED}, the filter
returns the value matchDisposition.
<li>If the mid call event type and value are not matched or the connection's state is not
{@link JccConnection#CONNECTED}, then return nomatchDisposition.
</ul>
@param midCallType an integer that represents the mid call type. Valid values are defined, i.e. {@link MidCallData#SERVICE_CODE_DIGITS SERVICE_CODE_DIGITS},
{@link MidCallData#SERVICE_CODE_FACILITY SERVICE_CODE_FACILITY}, {@link MidCallData#SERVICE_CODE_HOOKFLASH SERVICE_CODE_HOOKFLASH},
{@link MidCallData#SERVICE_CODE_RECALL SERVICE_CODE_RECALL}, {@link MidCallData#SERVICE_CODE_U2U SERVICE_CODE_U2U}, and
{@link MidCallData#SERVICE_CODE_UNDEFINED SERVICE_CODE_UNDEFINED}.
@param midCallValue a string or regular expression that constrains the mid call value (for the purpose of this specification, the platform
will use the Perl5 regular expressions).
@param matchDisposition indicates the disposition of a {@link JccConnectionEvent#CONNECTION_MID_CALL}, {@link JccConnection#getMidCallData() getMidCallData()}
gets access to the {@link MidCallData} object. The disposition should be one of the legal
dispositions namely, {@link EventFilter#EVENT_BLOCK}, {@link EventFilter#EVENT_DISCARD} or {@link EventFilter#EVENT_NOTIFY}.
@param nomatchDisposition indicates the disposition of a {@link JccConnectionEvent#CONNECTION_MID_CALL}. This should be one of the legal
dispositions namely, {@link EventFilter#EVENT_BLOCK}, {@link EventFilter#EVENT_DISCARD} or {@link EventFilter#EVENT_NOTIFY}.
@return EventFilter standard EventFilter provided by the JCC platform to enable
filtering of events based on the application's requirements.
@throws ResourceUnavailableException An internal resource for completing this request is unavailable.
@throws InvalidArgumentException One or more of the provided argument is not valid
@since 1.0b
*/
public EventFilter createEventFilterMidCallEvent(int midCallType, String midCallValue, int matchDisposition, int nomatchDisposition) throws
javax.csapi.cc.jcc.ResourceUnavailableException, javax.csapi.cc.jcc.InvalidArgumentException {
//return new MidCallEventFilter(midCallType, midCallValue, matchDisposition, nomatchDisposition);
throw new javax.csapi.cc.jcc.ResourceUnavailableException(javax.csapi.cc.jcc.ResourceUnavailableException.UNKNOWN);
}
/**
This method returns a standard EventFilter which is implemented by the JCC platform.
For all events that require filtering by this {@link EventFilter}, apply the following:
<ul>
<li>If the minimum address length is matched and the connection's state (e.g. returned by {@link JccConnection#getJccState()}) of the connection is {@link JccConnection#ADDRESS_ANALYZE}, the filter returns the value matchDisposition.
<li>If the minimum address length is not matched or the connection's state is not {@link JccConnection#ADDRESS_ANALYZE}, then return nomatchDisposition.
</ul>
Note that applications may need to remove this filter (through
{@link JccCall#removeConnectionListener(JccConnectionListener)} or
{@link JccProvider#removeConnectionListener(JccConnectionListener)}) if they are notified once. Otherwise the
filter may be satisfied each time a set of digits is added to the received address and keep firing.
If this is not desirable, the application needs to remove the listener as indicated above.
@param minimumAddressLength an integer that represents a minimum address length.
@param matchDisposition indicates the disposition of a {@link JccConnectionEvent#CONNECTION_ADDRESS_ANALYZE} where
the length of the address matches or is greater than the given minimum length. This should be one of the legal
dispositions namely, {@link EventFilter#EVENT_BLOCK}, {@link EventFilter#EVENT_DISCARD} or {@link EventFilter#EVENT_NOTIFY}.
@param nomatchDisposition indicates the disposition of a {@link JccConnectionEvent#CONNECTION_ADDRESS_ANALYZE} where
the length of the address is less than the given minimum length. This should be one of the legal
dispositions namely, {@link EventFilter#EVENT_BLOCK}, {@link EventFilter#EVENT_DISCARD} or {@link EventFilter#EVENT_NOTIFY}.
@return EventFilter standard EventFilter provided by the JCC platform to enable
filtering of events based on the application's requirements.
@throws ResourceUnavailableException An internal resource for completing this request is unavailable.
@throws InvalidArgumentException One or more of the provided argument is not valid
@since 1.0b
*/
public EventFilter createEventFilterMinimunCollectedAddressLength(int minimumAddressLength, int matchDisposition, int nomatchDisposition) throws
javax.csapi.cc.jcc.ResourceUnavailableException, javax.csapi.cc.jcc.InvalidArgumentException {
return new MinimumCollectedAddressLengthFilter(minimumAddressLength, matchDisposition, nomatchDisposition);
}
/**
* Describe myself.
* @return a string representation of the receiver
*/
public String toString() {
return "Jain Call Control Provider for the Generic JTAPI Framework.";
}
/**
* Register a GJTAPI Call with Jcc Listeners that have been registered using either
* Provider.addCallListener() or Provider.addConnectionListener().
* <P>This allows listeners to be registered with Jcc when they finally are visible to the Jcc Provider.
* @author rdeadman
*
*/
public void registerCallListeners(FreeCall gjtapiCall) {
// now add the JccCallListeners that I have queued up, by adding their adapters to the real call.
Iterator it = this.getCallListeners().values().iterator();
while (it.hasNext()) {
gjtapiCall.addCallListener((CallListener)it.next());
}
}
/**
* This method returns a standard EventFilter which is implemented by
* the JCAT platform. For all events that require filtering by this
* EventFilter, apply the following:
* <ul>
* <li>If the terminal name is matched, the filter returns the value matchDisposition.
* <li>If the terminal name is not matched, then return nomatchDisposition.
* </ul>
* @see javax.jcat.JcatProvider#createEventFilterRegistration(java.lang.String, int, int)
*/
public EventFilter createEventFilterRegistration(
String terminalNameRegex,
int matchDisposition,
int nomatchDisposition)
throws ResourceUnavailableException, InvalidArgumentException {
return new net.sourceforge.gjtapi.jcc.filter.TerminalREFilter(terminalNameRegex, matchDisposition, nomatchDisposition);
}
/**
* Returns a Set of JcatCall objects in which the JcatAddress participates.
* The call are currently associated with the JcatProvider. When a JcatCall
* moves into the JccCall.INVALID state, the JcatProvider loses its reference
* to this JcatCall. Therefore, all Calls returned by this method must either
* be in the JccCall.ACTIVE state. This method returns an empty Set if zero calls match the request.
*
* @see javax.jcat.JcatProvider#getCalls(javax.jcat.JcatAddress)
*/
public Set getCalls(JcatAddress address) {
String addrName = address.getName();
Set results = new HashSet();
// get all the calls on the GJTAPI provider
try {
Call[] calls = this.getGenProv().getCalls();
if ((calls == null) || (calls.length == 0))
return results;
int len = calls.length;
for (int i = 0; i < len; i++) {
Call call = calls[i];
Connection[] conns = call.getConnections();
int connLen = conns.length;
for (int j = 0; j < connLen; j++) {
Connection conn = conns[j];
if (conn.getAddress().getName().equals(addrName)) {
results.add(new GenCall(this, (FreeCall)call));
j = connLen; // don't need to check any more connections
}
}
}
} catch (javax.telephony.ResourceUnavailableException ruex) {
// I guess we return an empty set!
System.err.println("ResourceUnavailableException on getCalls(" + address + ") -- returning empty set.");
}
return results;
}
/**
* Returns a Set of JcatTerminal objects administered by the JcatProvider
* who's name satisfies the regular expression.
* <P>Note that the underlying system may throw a ResourceUnavailableException
* when trying to get all Terminals for matching, but we cannot. For now we log and eat the exception.
* @see javax.jcat.JcatProvider#getTerminals(java.lang.String)
*/
public Set getTerminals(String nameRegex) {
Set results = new HashSet();
try {
Terminal[] terms = this.getGenProv().getTerminals();
if ((terms == null) || (terms.length == 0))
return results;
Pattern p = Pattern.compile(nameRegex);
int len = terms.length;
for (int i = 0; i < len; i++) {
Matcher m = p.matcher(terms[i].getName());
if (m.matches())
results.add(new GenTerminal(this, (FreeTerminal)terms[i]));
}
} catch (javax.telephony.ResourceUnavailableException ruex) {
// I guess we return an empty set!
System.err.println("ResourceUnavailableException on getTerminals(" + nameRegex + ") -- returning empty set.");
}
return results;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -