To instantiate a pseudocomponent, call the ORB.object_to_string method, passing a URL that specifies the information required to load the component. Java, C++, PowerBuilder, and ActiveX all use a variation of this method.
The object URL for a pseudocomponent specifies the shared library file or Java class that contains the implementation, the EAServer package name, and the EAServer component name.
To identify a C++ pseudocomponent, format a URL as follows:
pseudo://cpp/library/package/component
Where:
library is
the base name of the shared library or DLL that contains the component
implementation, without the platform-specific file extension. For
example, mypseudo
to indicate
a file named mypseudo.dll on Windows or mypseudo.so on
Solaris or Linux. The location of the library must be specified
in the system’s library search path.
package is the EAServer Manager package name.
component is the EAServer Manager component name.
To identify a Java pseudocomponent, format a URL as follows:
pseudo://java/java-package/jaguar-package/component
Where:
java-package is
the is the dot-notation name of the Java package that contains the
component skeleton. This package is the same as the package used
by the implementation class. For example, if the implementation class
is com.sybase.sample.MyJavaPseudo, specify com.sybase.sample
as
the Java package name. The code base under which the class is deployed
must be specified in the CLASSPATH.
jaguar-package is the EAServer Manager package name.
component is the EAServer Manager component name.
Java applications or EAServer Java components can instantiate pseudocomponents implemented in Java or C++. Java applets cannot instantiate pseudocomponents. In order to instantiate a C++ pseudocomponent, the environment for a Java application must include all the settings required by the EAServer C++ client runtime, and the location of the library must be specified in the system’s library search path. Java stub classes for the pseudocomponent must be available.
You can instantiate a pseudocomponent any time after initializing and instantiating an ORB instance. Call the ORB.string_to_object method, passing a URL formatted as described in “Pseudocomponent object URLs”. Narrow the returned object to an interface supported by the component. See Chapter 12, “Creating CORBA Java Clients” for more information on the ORB interface and narrowing objects to an interface.
The following fragment instantiates a pseudocomponent proxy for a C++ component in the DLL CppPseudo.dll that is installed in the package Demo and has component name PseudoCpp. The returned object is narrowed to Arithmetic interface. On UNIX platforms, this syntax also works for a shared library with base name "CppPseudo", as in CppPseudo.so.
String url = "pseudo://cpp/CppPseudo/Demo/PseudoCPP"; org.omg.CORBA.Object obj = orb.string_to_object(url); _comp = ArithmeticHelper.narrow(obj);
The following fragment instantiates a pseudocomponent proxy for a Java component. The implementation class and skeleton class are in the Java package Sample.PseudoComponents. The component is installed in the EAServer package Demo and has component name PseudoJava. The returned object is narrowed to Arithmetic interface.
String url = "pseudo://java/Sample.PseudoComponents/Demo/PseudoJava"; org.omg.CORBA.Object obj = orb.string_to_object(url); _comp = ArithmeticHelper.narrow(obj);
C++ standalone programs or EAServer components can instantiate pseudocomponents implemented in C++. Pseudocomponents implemented in Java can be instantiated only by C++ components that are executing in EAServer.
In order to instantiate a C++ pseudocomponent in a standalone program, the environment must include all the settings required by the EAServer C++ client runtime, and the location of the library must be specified in the system’s library search path.
You can instantiate a pseudocomponent any time after initializing and instantiating an ORB instance. Call the ORB.string_to_object method, passing a URL formatted as described in “Pseudocomponent object URLs”. Narrow the returned object to an interface supported by the component. See Chapter 15, “Creating CORBA C++ Clients” for more information on the ORB interface and narrowing objects to an interface.
The following fragment instantiates a pseudocomponent proxy for a C++ component in the DLL CppPseudo.dll that is installed in the package Demo and has component name PseudoCpp. The returned object is narrowed to PseudocomponentDemo::Arithmetic interface. On UNIX platforms, this syntax also works for a shared library with base name "CppPseudo", as in CppPseudo.so.
String url = "pseudo://cpp/CppPseudo/Demo/PseudoCPP"; CORBA::Object_var obj = orb->string_to_object(url); PseudocomponentDemo::Arithmetic_var arith = PseudocomponentDemo::Arithmetic::_narrow(obj);
The following fragment instantiates a pseudocomponent proxy for a Java component. The implementation class and skeleton class are in the Java package Sample.PseudoComponents. The component is installed in the EAServer package Demo and has component name PseudoJava. The returned object is narrowed to PseudocomponentDemo::Arithmetic interface.
String url = "pseudo://java/Sample.PseudoComponents/Demo/PseudoJava"; CORBA::Object_var obj = orb->string_to_object(url); PseudocomponentDemo::Arithmetic_var arith = PseudocomponentDemo::Arithmetic::_narrow(obj);
To instantiate pseudocomponents in PowerScript, use the String_To_Object method in the JaguarORB object, specifying the pseudocomponent URL as the string to resolve. For example, the following code can be called in a PowerBuilder component to retrieve a proxy for the CtsSecurity/SessionInfo built-in pseudocomponent:
// PowerBuilder objects JaguarORB my_JaguarORB CORBAObject my_corbaobj // Proxy object for CtsSecurity::SessionInfo built in // pseudocomponent SessionInfo my_sessioninfo long ll_return my_JaguarORB = CREATE JaguarORB // Initialize the ORB ll_return = my_JaguarORB.init("") // Convert a URL string to an object reference ll_return = my_JaguarORB.String_To_Object & ("pseudo://cpp/libjdispatch/CtsSecurity/SessionInfo", & my_corbaobj) // Narrow the object reference to the Manager interface ll_return = my_corbaobj._narrow(my_sessioninfo, "CtsSecurity/SessionInfo")
For more information on using the JaguarORB object, see the Application Techniques manual in the PowerBuilder documentation. For information on the CtsSecurity/SessionInfo API, see the generated HTML documentation, available in the html/ir subdirectory of your EAServer installation.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |