下面列出了怎么用org.omg.CORBA.portable.Delegate的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
public Delegate getDelegate( ORB orb )
{
// write the IOR components to an org.omg.CORBA.portable.OutputStream
OutputStream ostr = orb.create_output_stream();
ostr.write_long(typeData.length);
ostr.write_octet_array(typeData, 0, typeData.length);
ostr.write_long(profileTags.length);
for (int i = 0; i < profileTags.length; i++) {
ostr.write_long(profileTags[i]);
ostr.write_long(profileData[i].length);
ostr.write_octet_array(profileData[i], 0, profileData[i].length);
}
InputStream istr = ostr.create_input_stream() ;
// read the IOR back from the stream
org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
return StubAdapter.getDelegate( obj ) ;
}
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
public Delegate getDelegate( ORB orb )
{
// write the IOR components to an org.omg.CORBA.portable.OutputStream
OutputStream ostr = orb.create_output_stream();
ostr.write_long(typeData.length);
ostr.write_octet_array(typeData, 0, typeData.length);
ostr.write_long(profileTags.length);
for (int i = 0; i < profileTags.length; i++) {
ostr.write_long(profileTags[i]);
ostr.write_long(profileData[i].length);
ostr.write_octet_array(profileData[i], 0, profileData[i].length);
}
InputStream istr = ostr.create_input_stream() ;
// read the IOR back from the stream
org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
return StubAdapter.getDelegate( obj ) ;
}
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
private boolean isLocal()
{
boolean result = false ;
Delegate delegate = StubAdapter.getDelegate( stub ) ;
if (delegate instanceof CorbaClientDelegate) {
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcrd =
ccil.getLocalClientRequestDispatcher() ;
result = lcrd.useLocalInvocation( null ) ;
}
}
return result ;
}
public Delegate getDelegate( ORB orb )
{
// write the IOR components to an org.omg.CORBA.portable.OutputStream
OutputStream ostr = orb.create_output_stream();
ostr.write_long(typeData.length);
ostr.write_octet_array(typeData, 0, typeData.length);
ostr.write_long(profileTags.length);
for (int i = 0; i < profileTags.length; i++) {
ostr.write_long(profileTags[i]);
ostr.write_long(profileData[i].length);
ostr.write_octet_array(profileData[i], 0, profileData[i].length);
}
InputStream istr = ostr.create_input_stream() ;
// read the IOR back from the stream
org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
return StubAdapter.getDelegate( obj ) ;
}
public Delegate getDelegate( ORB orb )
{
// write the IOR components to an org.omg.CORBA.portable.OutputStream
OutputStream ostr = orb.create_output_stream();
ostr.write_long(typeData.length);
ostr.write_octet_array(typeData, 0, typeData.length);
ostr.write_long(profileTags.length);
for (int i = 0; i < profileTags.length; i++) {
ostr.write_long(profileTags[i]);
ostr.write_long(profileData[i].length);
ostr.write_octet_array(profileData[i], 0, profileData[i].length);
}
InputStream istr = ostr.create_input_stream() ;
// read the IOR back from the stream
org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
return StubAdapter.getDelegate( obj ) ;
}
/**
* This method overrides the org.omg.CORBA.portable.Delegate.equals method,
* and does the equality check based on IOR equality.
*/
public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
{
if (other == null)
return false ;
if (!StubAdapter.isStub(other)) {
return false;
}
Delegate delegate = StubAdapter.getDelegate( other ) ;
if (delegate == null)
return false ;
if (delegate instanceof CorbaClientDelegateImpl) {
CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
delegate ;
IOR otherIor = otherDel.contactInfoList.getTargetIOR();
return this.contactInfoList.getTargetIOR().equals(otherIor);
}
// Come here if other is not implemented by our ORB.
return false;
}
public boolean is_equivalent(org.omg.CORBA.Object obj,
org.omg.CORBA.Object ref)
{
if ( ref == null )
return false;
// If ref is a local object, it is not a Stub!
if (!StubAdapter.isStub(ref))
return false ;
Delegate del = StubAdapter.getDelegate(ref) ;
if (del == null)
return false ;
// Optimize the x.is_equivalent( x ) case
if (del == this)
return true;
// If delegate was created by a different ORB, return false
if (!(del instanceof CorbaClientDelegateImpl))
return false ;
CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
CorbaContactInfoList ccil =
(CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
return this.contactInfoList.getTargetIOR().isEquivalent(
ccil.getTargetIOR() );
}
/** This also gets the delegate from a Servant by
* using Servant._this_object()
*/
public static Delegate getDelegate( Object stub )
{
if (stub instanceof DynamicStub)
return ((DynamicStub)stub).getDelegate() ;
else if (stub instanceof ObjectImpl)
return ((ObjectImpl)stub)._get_delegate() ;
else if (stub instanceof Tie) {
Tie tie = (Tie)stub ;
org.omg.CORBA.Object ref = activateTie( tie ) ;
return getDelegate( ref ) ;
} else
throw wrapper.getDelegateRequiresStub() ;
}
public boolean is_equivalent(org.omg.CORBA.Object obj,
org.omg.CORBA.Object ref)
{
if ( ref == null )
return false;
// If ref is a local object, it is not a Stub!
if (!StubAdapter.isStub(ref))
return false ;
Delegate del = StubAdapter.getDelegate(ref) ;
if (del == null)
return false ;
// Optimize the x.is_equivalent( x ) case
if (del == this)
return true;
// If delegate was created by a different ORB, return false
if (!(del instanceof CorbaClientDelegateImpl))
return false ;
CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
CorbaContactInfoList ccil =
(CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
return this.contactInfoList.getTargetIOR().isEquivalent(
ccil.getTargetIOR() );
}
public static void setDelegate( Object stub, Delegate delegate )
{
if (stub instanceof DynamicStub)
((DynamicStub)stub).setDelegate( delegate ) ;
else if (stub instanceof ObjectImpl)
((ObjectImpl)stub)._set_delegate( delegate ) ;
else
throw wrapper.setDelegateRequiresStub() ;
}
public static void setDelegate( Object stub, Delegate delegate )
{
if (stub instanceof DynamicStub)
((DynamicStub)stub).setDelegate( delegate ) ;
else if (stub instanceof ObjectImpl)
((ObjectImpl)stub)._set_delegate( delegate ) ;
else
throw wrapper.setDelegateRequiresStub() ;
}
/** This also gets the delegate from a Servant by
* using Servant._this_object()
*/
public static Delegate getDelegate( Object stub )
{
if (stub instanceof DynamicStub)
return ((DynamicStub)stub).getDelegate() ;
else if (stub instanceof ObjectImpl)
return ((ObjectImpl)stub)._get_delegate() ;
else if (stub instanceof Tie) {
Tie tie = (Tie)stub ;
org.omg.CORBA.Object ref = activateTie( tie ) ;
return getDelegate( ref ) ;
} else
throw wrapper.getDelegateRequiresStub() ;
}
public boolean is_equivalent(org.omg.CORBA.Object obj,
org.omg.CORBA.Object ref)
{
if ( ref == null )
return false;
// If ref is a local object, it is not a Stub!
if (!StubAdapter.isStub(ref))
return false ;
Delegate del = StubAdapter.getDelegate(ref) ;
if (del == null)
return false ;
// Optimize the x.is_equivalent( x ) case
if (del == this)
return true;
// If delegate was created by a different ORB, return false
if (!(del instanceof CorbaClientDelegateImpl))
return false ;
CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
CorbaContactInfoList ccil =
(CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
return this.contactInfoList.getTargetIOR().isEquivalent(
ccil.getTargetIOR() );
}
public static void setDelegate( Object stub, Delegate delegate )
{
if (stub instanceof DynamicStub)
((DynamicStub)stub).setDelegate( delegate ) ;
else if (stub instanceof ObjectImpl)
((ObjectImpl)stub)._set_delegate( delegate ) ;
else
throw wrapper.setDelegateRequiresStub() ;
}
public boolean is_equivalent(org.omg.CORBA.Object obj,
org.omg.CORBA.Object ref)
{
if ( ref == null )
return false;
// If ref is a local object, it is not a Stub!
if (!StubAdapter.isStub(ref))
return false ;
Delegate del = StubAdapter.getDelegate(ref) ;
if (del == null)
return false ;
// Optimize the x.is_equivalent( x ) case
if (del == this)
return true;
// If delegate was created by a different ORB, return false
if (!(del instanceof CorbaClientDelegateImpl))
return false ;
CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
CorbaContactInfoList ccil =
(CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
return this.contactInfoList.getTargetIOR().isEquivalent(
ccil.getTargetIOR() );
}
public static void setDelegate( Object stub, Delegate delegate )
{
if (stub instanceof DynamicStub)
((DynamicStub)stub).setDelegate( delegate ) ;
else if (stub instanceof ObjectImpl)
((ObjectImpl)stub)._set_delegate( delegate ) ;
else
throw wrapper.setDelegateRequiresStub() ;
}
/** This also gets the delegate from a Servant by
* using Servant._this_object()
*/
public static Delegate getDelegate( Object stub )
{
if (stub instanceof DynamicStub)
return ((DynamicStub)stub).getDelegate() ;
else if (stub instanceof ObjectImpl)
return ((ObjectImpl)stub)._get_delegate() ;
else if (stub instanceof Tie) {
Tie tie = (Tie)stub ;
org.omg.CORBA.Object ref = activateTie( tie ) ;
return getDelegate( ref ) ;
} else
throw wrapper.getDelegateRequiresStub() ;
}
public boolean is_equivalent(org.omg.CORBA.Object obj,
org.omg.CORBA.Object ref)
{
if ( ref == null )
return false;
// If ref is a local object, it is not a Stub!
if (!StubAdapter.isStub(ref))
return false ;
Delegate del = StubAdapter.getDelegate(ref) ;
if (del == null)
return false ;
// Optimize the x.is_equivalent( x ) case
if (del == this)
return true;
// If delegate was created by a different ORB, return false
if (!(del instanceof CorbaClientDelegateImpl))
return false ;
CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
CorbaContactInfoList ccil =
(CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
return this.contactInfoList.getTargetIOR().isEquivalent(
ccil.getTargetIOR() );
}
public static void setDelegate( Object stub, Delegate delegate )
{
if (stub instanceof DynamicStub)
((DynamicStub)stub).setDelegate( delegate ) ;
else if (stub instanceof ObjectImpl)
((ObjectImpl)stub)._set_delegate( delegate ) ;
else
throw wrapper.setDelegateRequiresStub() ;
}