PWB517 PBNI::Introduction by Example - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

PWB517 PBNI::Introduction by Example

Description:

Specialize in XML and Java content management systems. Background: ... C IDEs/Compilers. Visual C 6.0. Visual C .NET 2003. Borland C Builder. GNU gcc ... – PowerPoint PPT presentation

Number of Views:624
Avg rating:3.0/5.0
Slides: 25
Provided by: fell45
Category:

less

Transcript and Presenter's Notes

Title: PWB517 PBNI::Introduction by Example


1
PWB517 PBNIIntroduction by Example
Roy KieslerTeam Sybaseroy.kiesler_at_teamsybase.com

2
PBNIIntroduction by Example
Introductions
  • Roy Kiesler
  • Architect, Percussion Software, Professional
    Services.
  • Specialize in XML and Java content management
    systems.
  • Background C, PowerBuilder
  • Member of Team Sybase since 1999
  • Winner of the 2001, 2003 Team Sybase MVP ward
  • Audience
  • PowerBuilder developers
  • C developers
  • .NET developers
  • Sybase Tools Seminar 2003 attendees (Minneapolis,
    MN)

3
What is PBNI?
Whats in a Name?
  • PowerBuilder Native Interface
  • PowerScript
  • PBNI is a standard programming interface that
    allows developers to extend PowerScript with C
    classes
  • This feature is targeted at Client/Server
    applications, as well as rich distributed clients
  • PBVM Anywhere
  • PBNI also enables one to embed the PowerBuilder
    VM in C applications and either run complete
    PowerBuilder applications or invoke selective
    PowerScript functions
  • This feature provides the ability to deploy
    PowerBuilder custom class user objects to
    third-party application servers

4
What is PBNI?
Seeing is Believing
  • Code Examples
  • Power Pack
  • Fast array sorting
  • Base64 encoding/decoding
  • Bitwise operations
  • CPU information
  • ASA DBTools API
  • Network operations
  • Visual Controls
  • Custom-drawn List and Tree View controls
  • Owner-drawn command buttons
  • More
  • Callbacks
  • XPath

5
What is PBNI?
Seeing is Believing
  • Did you know?
  • Sybase is eating its own dog food with
    PowerBuilder 9.0
  • Web Services SOAP Client
  • EJB Client
  • PBDOM
  • All are PBNI implementations!

6
PBNIIntroduction by Example
PBNI Core Interfaces
  • PBNI exposes 4 core C interfaces

  • PBVM

  • Anywhere
  • PowerScript
  • IPB_Session
  • IPB_Value
  • IPB_Arguments
  • IPB_VM

7
PBNI-gtPowerScript
Core Interfaces
  • IPB_Session
  • An abstract interface that provides a low-level
    interface to PowerScript
  • Defines functions for
  • Accessing PowerScript data
  • Calling PowerScript functions
  • Catching and throwing PowerScript exceptions
  • Setting a marshaler to convert PowerBuilder data
    formats to the users communication protocol.
  • IPB_Value
  • An abstract interface that provides a high-level
    interface to PowerScript
  • Allows for better data integrity
  • Provides some protection from coding many
    operations that could cause crashes (e.g.,
    assigning a long value to a string variable)

8
PBNI-gtPowerScript
Core Interfaces
  • IPB_VM
  • An abstract interface that enables 3rd party
    client and server applications to load the
    PowerBuilder VM and run a PowerBuilder
    application/component
  • IPB_Arguments
  • An interface that encapsulates the functionality
    of passing values between the PowerBuilder VM and
    a PBX.
  • Arguments are passed as pointer to an instance of
    the IPB_Value interface.

9
PBNI Core Interfaces
The Big Picture
10
PBNI-gtPowerScript
Class Hierarchy
  • PBNI classes can inherit from
  • NonVisualObjet and its descendants, e.g.
  • Connection
  • Error
  • Exception
  • Transaction
  • UserObject and its descendants
  • PBNI extensions (PBXs) can expose
  • Object-level functions and events
  • Global functions

11
PBNIIntroduction by Example
PBNI-gtPowerScript
  • Advantages
  • Performance
  • True machine-code execution
  • Convenience
  • Ability to return strings and arrays instead of
    passing by REF
  • No need to pre-allocate memory using Space(n)
  • No need to declare complex structures
  • Auto-generated PBD just add to your library
    list and code

12
PBNIIntroduction by Example
PBNI-gtPowerScript
  • Limitations
  • Complexity
  • Solid C knowledge required, as PBNI uses
    advanced C concepts like templates and traits
  • Functionality
  • Properties can only be exposed via Get/Set
    methods, which, while common in C/Java, are
    less prevalent in PowerScript (uses instance
    variables)
  • Debugging
  • C debugger required

13
PBNIIntroduction by Example
PBNI-gtPowerScript
  • Required exported functions
  • PBX_GetDescription
  • Returns a string with PowerScript-like export
    syntax of all PBXs methods and events and any
    global functions. Used by the PBX2PBD90 tool.
  • PBX_CreateNonVisualObject
  • Invoked in response to a PowerScript CREATE
    statement
  • PBX_CreateVisualObject
  • Invoked when a new visual PBX is instantiated
  • PBX_InvokeGlobalFunction
  • Invoked when a global PBX function is called

14
PBNIIntroduction by Example
PBNI-gtDevelopment
  • Setting up a development environment
  • C IDEs/Compilers
  • Visual C 6.0
  • Visual C .NET 2003
  • Borland C Builder
  • GNU gcc
  • Include Directory (INCLUDE)
  • C\Sybase\PowerBuilder 9.0\SDK\PBNI\include
  • Library Directory (LIB)
  • C\Sybase\PowerBuilder 9.0\SDK\PBNI\lib

15
PBNIIntroduction by Example
PBNI-gtDevelopment
  • Header Files
  • pbext.h contains structures and interfaces used
    to implement PBXs
  • pbni.h contains structures and interface
    definitions for core PBNI
  • pbnimd.h contains machine-dependent (Win32) type
    definitions
  • pbarray.h contains template classes for creating
    and accessing arrays
  • pbfield.h contains template classes for creating
    and accessing class variables
  • pbtraits.h contains template structures used in
    pbarray.h and pbfield.h
  • Library Files
  • pbni.lib
  • Every PBNI class should include ltpbext.hgt
  • You should not include any other PBNI header
    file in your class

16
PBNIIntroduction by Example
PBNI-gtDevelopment Quick Start
  • Visual C 6.0 AppWizard
  • C\Sybase\PowerBuilder 9.0\SDK\PBNI\wizards\pbext.
    awx

17
PBNIIntroduction by Example
PBNI-gtDevelopment Quick Start
  • Visual C .NET AppWizard
  • http//codexchange.sybase.com

18
PBNIIntroduction by Example
PBNI-gtToday
  • PBNI implementations available today
  • XML/XSLT API
  • PBDOM, XPath evaluator
  • Java interoperability
  • PB2Java, EJB client, PDF encryption
  • .NET interoperability
  • PDF encryption
  • Web Services
  • SOAP client
  • Complex API wrappers
  • Callback functions (DBTools, Win32 enumerations)

19
PBNIIntroduction by Example
PBNI-gtToday
  • PBNI implementations available today
  • PB-friendly COM wrappers
  • Event support
  • Visual objects
  • Sub-classing
  • Custom/owner-drawn controls
  • Utility classes
  • Bitwise operations
  • SMTP
  • Base64
  • STL collection classes (map, list, queue, stack)
  • CPU Information

20
PBNIIntroduction by Example
PBNI-gtCode Examples
  • Code Walkthrough
  • PBNI Power Pack
  • .NET (Managed C)
  • Callbacks
  • Visual Controls
  • XPath Evaluator
  • More (time permitting)

21
PBNIIntroduction by Example
PBNI-gtTomorrow
  • PBNI implementations to look for
  • PBSAX XML Parser
  • NT Services
  • Windows Hooks

22
PBNIIntroduction by Example
PBNI-gtQuestions
23
TeamSybase Shameless Plug
Dont Judge a Book by Its Cover
  • Advanced Client/Server Internet Distributed
    Development

24
SDN Presents CodeXchange
A New Benefit for Sybase Developers
  • Forum for exchanging samples, tools, scripts,
    etc.
  • New features enable community collaboration
  • Download samples created by Sybase or external
    users
  • Leverage contributions of others to extend Sybase
    products
  • Contribute code or start your own collaborative /
    open source project with input from other product
    experts
  • Any SDN member can participate
  • Log in using your MySybase account via SDN
  • http//codexchange.sybase.com
  • Or via SDN at www.sybase.com/developer
  • SDN CodeXchange at TechWave
  • Visit SDN in the Technology Boardwalk
  • Learn about CodeXchange in the Sybase Booth
    Theater
Write a Comment
User Comments (0)
About PowerShow.com