Hello,

i am new java beginner and have some problems when i try to add "ListeningPoint" in mye class.

I got some error massege like this, but can not fix it:

<identifier> expected
[javac]     myListeningPoint = sipStack.createListeningPoint(port, "udp");
[javac]                     ^
[javac] 1 error

can you please help me ??

Here is the class:

package javax.sip;


import javax.sip.address.Router;
import java.util.*;


public interface SipStack {



public SipProvider createSipProvider(ListeningPoint listeningPoint)
throws ObjectInUseException;


public void deleteSipProvider(SipProvider sipProvider)
throws ObjectInUseException;



public Iterator getSipProviders();



public ListeningPoint createListeningPoint(int port, String transport)
throws TransportNotSupportedException, InvalidArgumentException;


ListeningPoint myListeningPoint();
myListeningPoint= sipStack.createListeningPoint(port, "udp");



public void deleteListeningPoint(ListeningPoint listeningPoint)
throws ObjectInUseException;



public Iterator getListeningPoints();


*/
public String getStackName();



*/
public String getIPAddress();



*/
public Router getRouter();



public boolean isRetransmissionFilterActive();


}

Your class is an interface: public interface SipStack
So you can not write code only declarations of methods and variables.
So this: myListeningPoint= sipStack.createListeningPoint(port, "udp"); shouldn't be there.
And by the way: myListeningPoint is declared as a method: ListeningPoint myListeningPoint();
This would be wrong anywhere you write it : myListeningPoint= sipStack.createListeningPoint(port, "udp");

On the other hand this would be correct:

SipStack stack = //somehow get an instant that extends this interface
ListeningPoint lPoint =  stack.myListeningPoint();

I am not sure that I need to use the method here,
But I would like to add some new ListeningPoint in this class. The primary ListeningPoint and secondary ListeningPoint.
How it is possible ?

Your class is an interface: public interface SipStack
So you can not write code only declarations of methods and variables.
So this: myListeningPoint= sipStack.createListeningPoint(port, "udp"); shouldn't be there.
And by the way: myListeningPoint is declared as a method: ListeningPoint myListeningPoint();
This would be wrong anywhere you write it : myListeningPoint= sipStack.createListeningPoint(port, "udp");

On the other hand this would be correct:

SipStack stack = //somehow get an instant that extends this interface
ListeningPoint lPoint =  stack.myListeningPoint();

Are you talking about variables or methods? If variables just declare them like you would any other variable. You have already declared a lot of stuff, is it difficult to add a few more? or perhaps I don't understand your question

I actually need to instantiate two ListeningPoint objects here and use one per interface. What is your idea to get this ?

Interfaces can only contain method signatures and final static fields. They are not the same as a class. You need to write a class that implements the interface if you want to add other properties.

I have a SipStackImpl class that implements the interface: (attached)

But it contains errors, that i can not find solution to.


Interfaces can only contain method signatures and final static fields. They are not the same as a class. You need to write a class that implements the interface if you want to add other properties.

Then post the code here in [code] [/code] tags and the exact error messages.

I actually need to instantiate two ListeningPoint objects here and use one per interface. What is your idea to get this ?

What do you mean use one per interface? The interface is one and you cannot instantiate it

I presume a terminal like SIP Communicator such use JAIN-SIP SIP-stack, with more than
one network interface. If more than one network interface can be used, one of them chosen
as the main/primary interface, while the other will act as backup interface.

I may still need to track interface state in some cases, but I am not sure HOW ?
Can you please help me ?

What do you mean use one per interface? The interface is one and you cannot instantiate it