Apache Directory Project - [jira] Created: (DIRMINA-147) Use URI instead of SocketAddress

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > December 2005 > [jira] Created: (DIRMINA-147) Use URI instead of SocketAddress





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [jira] Created: (DIRMINA-147) Use URI instead of SocketAddress
Trustin Lee (JIRA)

2005-12-19, 2:45 am

Use URI instead of SocketAddress
--------------------------------

Key: DIRMINA-147
URL: http://issues.apache.org/jira/browse/DIRMINA-147
Project: Directory MINA
Type: Improvement
Versions: 0.9
Reporter: Trustin Lee
Priority: Minor
Fix For: 0.9.1


We're using SocketAddress to point the address of remote (or local) peers, but it would be great if we can have a standardized mean to express the address. We're emulating SocketAddress in case of VM pipe, but it would be much better if we adopt higher-l
evel concept; URI.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secur...nistrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira


Donald

2005-12-19, 2:45 am

Oho,nice!
I'm using my custom URI interface in my app,it's very well if mina can
provide it.

2005/12/19, Trustin Lee (JIRA) <jira-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org>:
> Use URI instead of SocketAddress
> --------------------------------
>
> Key: DIRMINA-147
> URL: http://issues.apache.org/jira/browse/DIRMINA-147
> Project: Directory MINA
> Type: Improvement
> Versions: 0.9
> Reporter: Trustin Lee
> Priority: Minor
> Fix For: 0.9.1
>
>
> We're using SocketAddress to point the address of remote (or local) peers=

, but it would be great if we can have a standardized mean to express the a=
ddress. We're emulating SocketAddress in case of VM pipe, but it would be =
much better if we adopt higher-level concept; URI.
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
> http://issues.apache.org/jira/secur...nistrators.jspa
> -
> For more information on JIRA, see:
> http://www.atlassian.com/software/jira
>
>



--
Donald

Trustin Lee

2005-12-19, 2:45 am

Hi Donald,

You could suggest us an interface for URI class. Please reply as a JIRA
comment.

Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Donald

2005-12-19, 7:45 am

My URI inferface is a empty inteface,just for extend for future,it like thi=
s:

public interface URI {
}

and the implement for ipv4

public class SessionURI implements URI {

=09private String=09ip;

=09private int=09=09port;

=09public SessionURI(String ip, int port)
=09{
=09=09this.ip =3D ip;
=09=09this.port =3D port;
=09}

=09public int getPort()
=09{
=09=09return port;
=09}

=09public String getIp()
=09{
=09=09return ip;
=09}

=09public boolean equals(Object o)
=09{
=09=09if (o =3D=3D null)
=09=09=09return false;
=09=09if (o =3D=3D this)
=09=09=09return true;
=09=09if (!(o instanceof SessionURI))
=09=09=09return false;
=09=09SessionURI another =3D (SessionURI) o;
=09=09return another.getIp().equals(ip) && another.getPort() =3D=3D port;
=09}

=09public int hashCode()
=09{
=09=09int result =3D 17;
=09=09result =3D 37 * result + ip.hashCode();
=09=09result =3D 37 * result + port;
=09=09return result;
=09}

=09public String toString()
=09{
=09=09return ip + ":" + port;
=09}
}

I think it's too simple,WDYT?

2005/12/19, Trustin Lee <trustin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> Hi Donald,
>
> You could suggest us an interface for URI class. Please reply as a JIRA
> comment.
>
> Cheers,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/



--
Donald

Trustin Lee

2005-12-19, 7:45 am

I think it would be great if we can make URI interface as many methods as it
can so ppl can use it easily. Empty interface is useless IMHO.

And why don't you post your comment in JIRA so we can track the whole
conversation?

Trustin

2005/12/19, Donald <flyingbug-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>
> My URI inferface is a empty inteface,just for extend for future,it like
> this:
>
> public interface URI {
> }
>
> and the implement for ipv4
>
> public class SessionURI implements URI {
>
> private String ip;
>
> private int port;
>
> public SessionURI(String ip, int port)
> {
> this.ip = ip;
> this.port = port;
> }
>
> public int getPort()
> {
> return port;
> }
>
> public String getIp()
> {
> return ip;
> }
>
> public boolean equals(Object o)
> {
> if (o == null)
> return false;
> if (o == this)
> return true;
> if (!(o instanceof SessionURI))
> return false;
> SessionURI another = (SessionURI) o;
> return another.getIp().equals(ip) && another.getPort() ==
> port;
> }
>
> public int hashCode()
> {
> int result = 17;
> result = 37 * result + ip.hashCode();
> result = 37 * result + port;
> return result;
> }
>
> public String toString()
> {
> return ip + ":" + port;
> }
> }
>
> I think it's too simple,WDYT?
>
> 2005/12/19, Trustin Lee <trustin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>
>
> --
> Donald
>




--
what we call human nature is actually human habit
--
http://gleamynode.net/

Donald

2005-12-19, 7:45 am

U29ycnksSSBmb3JnZXQgbXkgcGFzc3dvcmQgYW5k
IHRyeSBpdCBvdXQganVzdCBub3cuLi4uo61f
o60hIQoKMjAwNS8xMi8xOSwgVHJ1c3RpbiBMZWUg
PHRydXN0aW5AZ21haWwuY29tPjoKPiBJIHRo
aW5rIGl0IHdvdWxkIGJlIGdyZWF0IGlmIHdlIGNh
biBtYWtlIFVSSSBpbnRlcmZhY2UgYXMgbWFu
eSBtZXRob2RzIGFzIGl0Cj4gY2FuIHNvIHBwbCBj
YW4gdXNlIGl0IGVhc2lseS4gIEVtcHR5IGlu
dGVyZmFjZSBpcyB1c2VsZXNzIElNSE8uCj4KPiBB
bmQgd2h5IGRvbid0IHlvdSBwb3N0IHlvdXIg
Y29tbWVudCBpbiBKSVJBIHNvIHdlIGNhbiB0cmFj
ayB0aGUgd2hvbGUKPiBjb252ZXJzYXRpb24/
Cj4KPiBUcnVzdGluCj4KPiAyMDA1LzEyLzE5LCBE
b25hbGQgPGZseWluZ2J1Z0BnbWFpbC5jb20+
Ogo+ID4gTXkgVVJJIGluZmVyZmFjZSBpcyBhIGVt
cHR5IGludGVmYWNlLGp1c3QgZm9yIGV4dGVu
ZCBmb3IgZnV0dXJlLGl0IGxpa2UKPiB0aGlzOgo+
ID4KPiA+IHB1YmxpYyBpbnRlcmZhY2UgVVJJ
IHsKPi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doYXQgd2UgY2FsbCBo
dW1hbiBuYXR1cmUgaXMgYWN0dWFsbHkgaHVt
YW4gaGFiaXQKPiA+ID4gLS0KPiA+ID4gaHR0cDov
L2dsZWFteW5vZGUubmV0Lwo+ID4KPiA+Cj4g
PiAtLQo+ID4gRG9uYWxkCj4gPgo+Cj4KPgo+IC0t
Cj4KPiB3aGF0IHdlIGNhbGwgaHVtYW4gbmF0
dXJlIGlzIGFjdHVhbGx5IGh1bWFuIGhhYml0Cj4g
LS0KPiBodHRwOi8vZ2xlYW15bm9kZS5uZXQv
CgoKLS0KRG9uYWxkCg==

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com