4D (4th Dimension) 6.0.5J serial key or number
4D (4th Dimension) 6.0.5J serial key or number
4D_Pack
4D_Pack
______________________________________________________________________________________________________________________________________
Reference Guide
Windows® / Mac OS®
4th Dimension®
© 4D SA / 4D Inc. All rights reserved.
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
4D_Pack - Reference Guide
Version for Windows® and Mac OS®
Copyright © 4D SA/4D, Inc.
All rights reserved.
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
The Software described in this manual is governed by the grant of license in the 4D
Product Line License Agreement provided with the Software in this package. The
Software, this manual, and all documentation included with the Software are
copyrighted and may not be reproduced in whole or in part except for in accordance
with the 4D Product Line License Agreement.
4th Dimension, 4D, the 4D logo, and 4D Server are registered trademarks of 4D, Inc.
Microsoft and Windows are registered trademarks of Microsoft Corporation.
Apple, Macintosh, Mac OS and QuickTime are trademarks or registered trademarks of
Apple Computer, Inc.
Mac2Win Software Copyright © , is a product of Altura Software, Inc.
This product includes software developed by the Apache Software Foundation
(cromwellpsi.com).
4th Dimension includes cryptographic software written by Eric Young
(eay@cromwellpsi.com)
4th Dimension includes software written by Tim Hudson (tjh@cromwellpsi.com).
ACROBAT © Copyright , Secret Commercial Adobe Systems Inc. All rights
reserved. ACROBAT is a registered trademark of Adobe Systems Inc.
4D_Pack is based in part on the work of the Independent JPEG Group and the Quest
Center at Cold Spring Harbor Labs.
All other referenced trade names are trademarks or registered trademarks of their
respective holders.
Contents
1. Preface
4D_Pack, Introduction
2. 4D_Pack : User Interface 11
AP Rect dragger 13
AP PICT DRAGGER
%AP PICT displayer 15
AP PICT UPDATER 16
AP FULL SCREEN 17
AP NORMAL SCREEN 18
3. 4D_Pack : Windows Help Files.. 19
AP HELP ON KEY 21
AP HELP INDEX 22
AP HELP ON HELP 23
AP CLOSE HELP 24
4. 4D_Pack : Utilities
AP Sublaunch
AP Toolbar installed
AP ShellExecute
AP Get table info 32
AP Get field infos
AP Add table and fields
AP Get templates
AP Create relation 39
AP Create method
AP SET WEB FILTERS 42
AP Get tips state
AP SET TIPS STATE
4D_Pack - Reference Guide 3
AP Set palette
AP SET PICT MODE 47
AP Timestamp to GMT 48
AP Get picture type 49
AP AVAILABLE MEMORY 50
AP Select document 51
AP GET PARAM
AP SET PARAM 54
5. 4D_Pack : External Clock
_AP External clock 61
AP SET CLOCK 62
6. 4D_Pack : Printing 63
AP Print settings to BLOB 65
AP BLOB to print settings 66
AP PrintRec to text 68
AP Text to PrintRec
AP PrValidate
AP PrintDefault
7. 4D_Pack : ANSI Streams 73
AP fopen 75
AP FPRINT 77
AP FCLOSE 78
AP fread 79
8. 4D_Pack : Picture Files
AP Read Picture File 83
AP Save BMP 8 bits
4 4D_Pack - Reference Guide
AP Read Picture BLOB
AP Save GIF
Command Index
4D_Pack - Reference Guide 5
6 4D_Pack - Reference Guide
1
______________________
Preface
4D_Pack - Reference Guide 7
8 4D_Pack - Reference Guide
4D_Pack, Introduction Preface
version (Modified)
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
The 4D_Pack plug-in provides 4D developpers with useful additional routines.
The 4D_Pack command names have the “AP” prefix in order to avoid any confusion with 4D
commands. They also use the uppercase/lowercase convention depending on whether they are
commands or functions.
Installation
You install the 4D_Pack plug-in just as any 4th Dimension plug-in. For more information,
refer to the 4th Dimension Product Line Installation Guide.
Package Contents
The 4D_Pack package contains several routines grouped into the following themes:
Themes
User Interface
Windows Help Files
Utilities
External Clock
Picture Files
Printing
ANSI streams
Description
User interface management
Using the Help Manager (Windows only)
Miscellaneous routines
“Analog” clock displayed in a plug-in area
Picture management
Management of the printing parameters
Management of sending data to files and ports
4D_Pack - Reference Guide 9
10 4D_Pack - Reference Guide
2
______________________
4D_Pack : User Interface
4D_Pack - Reference Guide 11
12 4D_Pack - Reference Guide
AP Rect dragger
4D_Pack : User Interface
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Rect dragger (left; top; right; bottom; x; y) Æ Integer
Parameter Type Description
left Longint Æ Left coordinate of the visible rectangle
top Longint Æ Top coordinate of the visible rectangle
right Longint Æ Right coordinate of the visible rectangle
bottom Longint Æ Bottom coordinate of the visible rectangle
x Longint ¨ Horizontal location of the mouse
y Longint ¨ Vertical location of the mouse
Function result Integer ¨ Process ID of the process in which
the item was dragged
Description
AP Rect dragger allows you to implement a “Drag and Drop” interface within 4D. It displays a
graphical representation of an item being dragged from one place to antoher and returns the
coordinates of the mouse release and the process ID of the process in which the item was
dragged.
See Also
AP PICT DRAGGER, CALL PROCESS.
4D_Pack - Reference Guide 13
AP PICT DRAGGER
4D_Pack : User Interface
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP PICT DRAGGER (picture; x; y)
Parameter Type Description
picture Picture Æ Picture to be dragged
x Longint Æ Horizontal coordinate after the move
y Longint Æ Vertical coordinate after the move
Description
The AP PICT DRAGGER command allows you to implement a drag and drop operation on an
image in the active window.
The call is implemented from an invisible button. The x and y variables receive the new
coordinates generated by the mouse release.
See Also
AP Rect dragger.
14 4D_Pack - Reference Guide
%AP PICT displayer
4D_Pack : User Interface
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
%AP PICT displayer is a plug-in area that allows you to display a picture set using the AP PICT
UPDATER routine or automatically loaded from a PICT resource. To automatically display a
picture coming from a resource, give your plug-in area a name with an alphabetic first
character, followed by the resource ID number of the picture you want to see. For example, to
display the PICT resource #, you may name your area “v”.
PICT resources should belong to the database structure resource file.
See Also
AP PICT UPDATER.
4D_Pack - Reference Guide 15
AP PICT UPDATER
4D_Pack : User Interface
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP PICT UPDATER (area; image)
Parameter Type Description
area Longint Æ %AP PICT displayer plug-in area
image Picture Æ Image to be updated
Description
The AP PICT UPDATER command enables you to set or change the picture displayed in a plugin
area managed by the %AP PICT displayer routine. Unlike regular 4D areas, which are redrawn
according to form events, AP PICT UPDATER immediately redraws the area at the screen. You
can thus use it within a loop to perform animation effects.
See Also
%AP PICT displayer.
16 4D_Pack - Reference Guide
AP FULL SCREEN
4D_Pack : User Interface
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP FULL SCREEN
Parameter Type Description
This command does not require any parameters
Description
The AP FULL SCREEN command enables you to hide the menu bar and the title bar of the 4D
application window and to set this window to full-screen size.
This command only works on Windows.
See Also
AP NORMAL SCREEN.
4D_Pack - Reference Guide 17
AP NORMAL SCREEN
4D_Pack : User Interface
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP NORMAL SCREEN
Parameter Type Description
This command does not require any parameters
Description
The AP NORMAL SCREEN command enables you to resize a menu bar and a title bar that were
previously hidden by the AP FULL SCREEN command.
This command only works in Windows.
See Also
AP FULL SCREEN.
18 4D_Pack - Reference Guide
3
______________________
4D_Pack : Windows Help
Files
4D_Pack - Reference Guide 19
20 4D_Pack - Reference Guide
AP HELP ON KEY
4D_Pack : Windows Help Files
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP HELP ON KEY (help; keyword)
Parameter Type Description
help String Æ Name of the Help file
keyword String Æ Keyword used to search for help
Description
The AP HELP ON KEY command opens a Help file whose name is passed as a parameter. This
command uses the standard Windows Help utility, which displays a page corresponding to the
keyword found (on Windows only).
4D_Pack - Reference Guide 21
AP HELP INDEX
4D_Pack : Windows Help Files
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP HELP INDEX (help)
Parameter Type Description
help String Æ Name of the Help file
Description
The AP HELP INDEX command displays the list of keywords available in the Help file whose
name was passed as a parameter (on Windows only).
22 4D_Pack - Reference Guide
AP HELP ON HELP
4D_Pack : Windows Help Files
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP HELP ON HELP
Parameter Type Description
This command does not require any parameters
Description
The AP HELP ON HELP command displays the on-line help for the program’s own Help file (on
Windows only).
4D_Pack - Reference Guide 23
AP CLOSE HELP
4D_Pack : Windows Help Files
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP CLOSE HELP
Parameter Type Description
This command does not require any parameters
Description
The AP CLOSE HELP command closes the Windows Help application (on Windows only).
24 4D_Pack - Reference Guide
4
______________________
4D_Pack : Utilities
4D_Pack - Reference Guide 25
26 4D_Pack - Reference Guide
AP Sublaunch
4D_Pack : Utilities
version (Modified)
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Sublaunch (filename; mode) Æ Longint
Parameter Type Description
filename String Æ Name of the application or document to launch
mode Number Æ Status of windows at time of launch (Windows)
Synchronous mode (Macintosh)
Function result Longint ¨ 0, if the command execution succeeded;
otherwise a system error code
Description
AP Sublaunch enables you to launch an application or to open a document from within 4D.
On Windows
• Applying this command to an executable file is equivalent to running that file using the
Open command from the File menu of the window. Therefore, you can pass switches as well as
names of documents to be opened by the executable file.
• The mode parameter sets the appearance mode of the window in which the application will
be launched:
- if mode is set to 0, the application window is normally displayed.
- if mode is set to 1, the application window is in full screen.
- if mode is set to 2, the application window is reduced and appears in the task bar (Windows
95/98 and NT 4).
On Macintosh
• You can pass a filename or an application name in filename. Applying this command to an
application or a document is equivalent to double-clicking the icon of the application or the
document in the Finder.
• The mode parameter set to 0 specifies an asynchronous launch. mode set to 1 specifies a
synchronous launch.
When the application is launched with or without documents, you can drive it using DDE
Tools, OLE Tools (Windows) or Apple Events (Macintosh).
4D_Pack - Reference Guide 27
If the operation is successfully completed, the function returns 0; otherwise it returns a
negative error code.
Warning: The behavior of this command depends on many parameters; its result is not
guaranteed for all applications.
Examples
1. Windows
2. Macintosh
See Also
$errCode:=AP Sublaunch("C:\WINDOWS\cromwellpsi.com";1)
` Will start the Calculator
$errCode:=AP Sublaunch("C:\WINDOWS\cromwellpsi.com D:\DOCS\cromwellpsi.com";1)
` Will start the Windows Note Pad, which will open the document cromwellpsi.com
$errCode:=AP Sublaunch("MyDisk:MyFolder:MyApp";0) ` Will start MyApp
$errCode:=AP Sublaunch("MyDisk:MyFolder:MyDoc";0)
` Will start the application to which MyDoc belongs, then open this later
AP ShellExecute.
28 4D_Pack - Reference Guide
AP Toolbar installed
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Toolbar installed Æ Longint
Parameter Type Description
This command does not require any parameters
Function result Longint ¨ Status of the toolbar
Description
AP Toolbar installed returns 1 if the toolbar is installed; otherwise, it returns 0. You can use it to
determine where to create a window on screen.
4D_Pack - Reference Guide 29
AP ShellExecute
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP ShellExecute (fileName{; mode{; param}}) Æ Longint
Parameter Type Description
fileName String Æ Name of file or document to be launched
mode Longint Æ Status of window at time of launch (Windows)
Synchronous mode (Mac OS)
param Text Æ Application parameters (Windows)
Function result Longint ¨ 0, if the command execution succeeded;
otherwise, a system error
Description
The AP ShellExecute command enables you to launch an application or open a document
from a 4D database.
Note: This command is similar to the existing AP Sublaunch command; however, its
operation has been optimized under Windows, in particular via the use of the 3rd
parameter.
Under Windows
In the fileName parameter, pass the name or complete (absolute) access path of the file to
be launched. When the application or document to be opened is located next to the
database structure, it is possible to pass only the file name or a relative access path.
Simply indicate a document name and Windows handles the execution of the associated
application.
The mode parameter enables you to specify the display mode of the window in which the
application will be launched:
• if you pass 0, the window will be normal;
• if you pass 1, the window will be full-screen;
• if you pass 2, the window will be reduced and will appear in the Windows task bar.
The param parameter enables you to pass any additional type of parameter that may be
necessary for the launched application. For instance, if you use this command to launch a
Web browser, you can pass a specific URL in this parameter.
Note: The param parameter is only used under Windows. It is ignored under Mac OS.
30 4D_Pack - Reference Guide
Under Mac OS
In the fileName parameter, pass the name or complete (absolute) access path of the file to
be launched. When the application or document to be opened is located next to the
database structure, it is possible to pass only the file name or a relative access path.
Simply indicate a document name and Mac OS handles the execution of the associated
application.
The mode parameter enables you to specify synchronous (if you pass 1) or asynchronous (if
you pass 0) opening of the application or document.
Examples
1. This example opens a Word® document located at the root of the main disk:
`Under Windows
$err:=AP ShellExecute ("C:\cromwellpsi.com")
`Under Mac OS
$err:=AP ShellExecute ("HardDisk:cromwellpsi.com")
2. This example launches an internet browser, in full-screen mode by default, on the 4D
site:
$err:=AP ShellExecute ("cromwellpsi.com";"1")
3. This example (Windows) opens the 4D site in full-screen on Netscape® whatever the
default internet browser:
$err:=AP ShellExecute ("C:\Program Files\Netscape\cromwellpsi.com";"1";"cromwellpsi.com")
4. This example opens the Windows Explorer in a normal window and displays the
contents of the Music folder:
See Also
AP Sublaunch.
$err:=AP ShellExecute ("C:\WINDOWS\cromwellpsi.com";0;"C:\Music")
4D_Pack - Reference Guide 31
AP Get table info
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Get table info (table; invisible; destruct) Æ Integer
Parameter Type Description
table Integer Æ Table number
invisible Integer ¨ 1, if the table is invisible
0, if the table is visible
destruct Integer ¨ 1, for physical deletion of the records
0, for logical deletion of the records
Function result Integer ¨ Error code
Description
AP Get table info returns information on 4D tables.
Given the table number, the invisible parameter is set to 1 if the table is declared as invisible in
Design mode, otherwise it is set 0.
The destruct variable is set to 1 for physical deletion of the records, or 0 for logical deletion.
The physical deletion of the records is slower than the logical one but it prevents the record
from reappearing in case of a "recover by tags" with 4D Tools.
32 4D_Pack - Reference Guide
AP Get field infos
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Get field infos (table; field; relTable; relFld; props; choiceList) Æ Integer
Parameter Type Description
table Integer Æ Table number
field Integer Æ Field number
relTable Integer ¨ Related table
relFld Integer ¨ Related field
props Longint ¨ Field properties
choiceList String ¨ Choice list
Function result Integer ¨ Error code
Description
AP Get field infos returns specific information about a field.
Given the table number and field number, the command returns the linked table and the
linked field number, respectively.
If there is no relation with the given field, relTable and relFld are set to 0.
The 16 bits of props are meaningful. Each bit can be read via bits operators of 4D language.
Bit number: Is set to 1 if: Ignored if field type is:
15 Indexed Text, Picture, Subtable or Blob
14 Indexed unique Text, Picture or Subtable or Blob
or if bit 15 is set to 0
13 Mandatory Subtable
12 Choice list Picture, Subtable or Blob
11 Modifiable Subtable
10 Enterable Subtable
8 Invisible
6 N to 1 relation Text, Picture, Subtable or Blob
5 1 to N relation Text, Picture, Subtable or Blob
4D_Pack - Reference Guide 33
2 and 1 Automatic 1 to N relation whose
deletion control is:
00 No deletion control
01 No assignment of related records
10 Deletion of related records
11 Deletion of related records not allowed
0 Automatic N to 1 relation Text, Picture, Subtable, Blob,
with automatic assignment
or if bit 5 not set
Note: Bits 3, 4, 7 and 9 are reserved for future use.
If bit 12 is set, the variable choiceList contains the name of the list.
34 4D_Pack - Reference Guide
AP Add table and fields
4D_Pack : Utilities
version (Modified)
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Add table and fields (tableName; fieldNamesArray; fieldTypesArray; fieldLengthsArray{;
listFormTemplate{; detailFormTemplate}}) Æ Longint
Parameter Type Description
tableName String Æ Name of table to be created
fieldNamesArray String Array Æ Array of field names
fieldTypesArray Longint Array Æ Array of field types
fieldLengthsArray Longint Array Æ Array of field lengths for Alpha fields
(0 for non-Alpha fields)
listFormTemplate String Æ Template to use for the default list form creation
detailFormTemplate String Æ Template to use for the default detail form creation
Function result Longint ¨ Number of the table created or error code
Description
The AP Add table and fields command lets you add a table and its fields in a 4th Dimension
database structure.
Note: This command was created mainly for the needs of 4D ODBC Pro plug-in users.
Pass the name of the table in tableName. This name can be up to 31 characters long. It can
contain any combination of letters, numbers, spaces and underlines.
The command creates as many fields in the table as there are elements in the
fieldNamesArray, fieldTypesArray and fieldLengthsArray arrays. The information passed in
each element is used to create the corresponding fields. The first element of the arrays will
be used for the first field of the table, and so on.
Note: To create an empty table, pass empty arrays.
• Pass the names of all the fields to be created in the tableName table in fieldNamesArray.
Each field name can be up to 31 characters long. It must begin with a letter but you can
then use any type of letter or number, as well as spaces and/or underlines.
• Pass the types of each field in fieldTypesArray. You can use the following 4D constants,
located in the “Field and Variable Types” theme:
Constant Type Value
Is Alpha Field Longint 0
Is Text Longint 2
Is Real Longint 1
4D_Pack - Reference Guide 35
Is Integer Longint 8
Is Longint Longint 9
Is Date Longint 4
Is Time Longint 11
Is Boolean Longint 6
Is Picture Longint 3
Is BLOB Longint 30
• For each Alpha field created, pass a length in fieldLengthsArray. For other types of fields,
this value is not necessary and you can pass 0.
The fields are created with the default properties. The table is automatically placed in the
“Top Level” group.
The table is created with its two default forms. These forms are designed using the current
form template. You can define the templates to use for the creation of these default forms
using the optional listFormTemplate and detailFormTemplate parameters. In
listFormTemplate, pass the name of the template you want to be used for the default list
(output) form. In detailFormTemplate, pass the name of the template you want to be used
for the default detail (input) form.
The form templates can be selected in the Form Wizard dialog box. You can get the list of
form templates available in your 4D application using the 4DPack command AP Get
templates.
If it has been successfully executed, the command returns the number of the table created.
This number, which is automatically assigned by 4th Dimension, corresponds to the value
returned by the expression: Count tables + 1.
If the table could not be created (for example, if you pass the name of an existing table),
the command returns one of the following error codes:
Code Description
-1 Invalid parameter (blank table name for example)
-2 A table with the same name already exists
-3 Incorrect array type (text array instead of integer array for example)
-4 Incorrect array size (the arrays are not of the same size for example)
-5 Incorrect field type (type does not exist for example)
-6 An error occurred when adding a field
-7 An error occurred when creating the table
Note: This command does not work when it is executed from a compiled application that
has been merged with 4D Runtime Volume License.
36 4D_Pack - Reference Guide
Examples
1. This method lets you create an [Employees] table:
ARRAY STRING(31;tFieldNames;5)
ARRAY LONGINT(tFieldTypes;5)
ARRAY LONGINT(tFieldLengths;5)
C_LONGINT($ret)
`Initialization of the arrays
tFieldNames{1}:="Name"
tFieldTypes{1}:=Is Text
tFieldLengths{1}:=0
` Fill in all the array items (2, 3, 4 and 5)
$ret:=AP Add table and fields("Employees";tFieldNames; tFieldTypes;tFieldLengths)
2. This method will create a table with two fields; default forms will use the 2nd and 3rd
templates:
C_STRING(25;TableName)
C_STRING(;$FormTempList;$FormTempDetail)
ARRAY STRING(31;FieldsNameArray;2)
ARRAY LONGINT(FieldsTypeArray;2)
ARRAY LONGINT(FieldsLengthArray;2)
ARRAY STRING(;$ArrTemplates;0)
TableName:="NewTable"
FieldsNameArray{1}:="FirstField"
FieldsTypeArray{1}:=Is Alpha Field
FieldsLengthArray{1}:=20
FieldsNameArray{2}:="SecondField"
FieldsTypeArray{2}:=Is LongInt
FieldsLengthArray{2}:=0
$error:=AP Get templates ($ArrTemplates)
If ($error=0)
$FormTempList:=$ArrTemplates{3}
$FormTempDetail:=$ArrTemplates{2}
$NumTable:=AP Add table and fields(TableName;FieldsNameArray;FieldsTypeArray;
FieldsLengthArray;$FormTempList;$FormTempDetail)
Else
$NumTable:=AP Add table and fields(TableName;FieldsNameArray;FieldsTypeArray;
FieldsLengthArray)
End if
4D_Pack - Reference Guide 37
AP Get templates
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Get templates (templateNameArray)
Parameter Type Description
templateNameArray String Array ¨ Array of template names
Description
The AP Get templates command populates the array templateNameArray with the list of the
form templates available in the current 4th Dimension application.
The form templates can be selected in the Form Wizard dialog box. Available built-in
templates are for example Nostalgia, OSX, OSX (no labels), Philadelphia, etc. Customized
forms built in the Advanced pages of the Form Wizard can be added as templates.
This command is useful when you use the AP Add table and fields command, because you can
determine the template to use for the default forms.
Note: This command does not work when it is executed from an application that has been
compiled and merged 4D Runtime Volume License.
If the command has been executed properly, it returns 0. Otherwise, it returns an error code.
Example
This example creates a window containing all the available templates:
See Also
$ref:=Open window(WLeft;WTop;;;8;"Template List")
ARRAY STRING(;ArrTemplates;0)
$error:=AP Get templates (ArrTemplates)
DIALOG([Table 1];"ArrTemplates")
CLOSE WINDOW($ref)
AP Add table and fields.
38 4D_Pack - Reference Guide
AP Create relation
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Create relation (sourceTableNum; sourceFieldNum; destTableNum; destFieldNum) Æ Longint
Parameter Type Description
sourceTableNum Longint Æ Number of the table from which the relation starts
sourceFieldNum Longint Æ Number of the field from which the relation starts
destTableNum Longint Æ Number of the table where the relation arrives
destFieldNum Longint Æ Number of the field where the relation arrives
Function result Longint ¨ Error code (0=no error)
Description
The AP Create relation command allows you to create a relation between two tables. In
sourceTableNum and sourceFieldNum, pass the numbers of the source table and field, and in
destTableNum and destFieldNum, pass the numbers of the destination table and field.
The relation is created with standard properties. You can use 4D relation management
commands to get or set these properties.
If the operation is completed successfully, the function returns 0. Otherwise, it returns an
error code.
Note: This command does not work when it is executed from a compiled application that has
been merged with 4D Runtime Volume License.
Example
This example creates a relation from table 1 to table 2:
C_LONGINT($SourceTable;$SourceField;$DestTable;$DestField)
$SourceTable:=1
$SourceField:=2
$DestTable:=2
$DestField:=2
$error:=AP Create relation ($SourceTable;$SourceField;$DestTable;$DestField)
4D_Pack - Reference Guide 39
AP Create method
4D_Pack : Utilities
version
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
AP Create method (methodName; propertiesArray; methodCode{; folderName}) Æ Longint
Parameter Type Description
Introduction
JbyJ is a 4D plug-in to build a distributed system or Peer-to-Peer system using Java RMI. JbyJ provides plug-in methods to call project methods mutually between 4Ds in a network. If you use the JbyJ class library, it enables your Java programs to call project methods of 4D in a network.
Java RMI: cromwellpsi.com
RMI is used as a communication protocol in JbyJ. Because some firewalls block this protocol, JbyJ also supports HTTP/HTTPS to pass the firewalls.
JbyJ requires JWorld, which is another 4D plug-in and distributed with JbyJ, in order to launch a Java virtual machine.
System Requirements
The current version of JbyJ works with 4th Dimension v11, 4D Server v11, 4th Dimension v12 or 4D Server v12(bit).
JbyJ requires a Java virtual machine(JVM) to run. The JVM is launched by JWorld which is another 4D plug-in and distributed with JbyJ. In Mac OS, Apple's system built-in JVM is launched. In Windows, JWorld's built-in JVM(JRE version 6 Update 18) is launched. In Windows, other JVM can be specified.
License Types
JbyJ has two license types JbyJ STD and JbyJ PRO:
- JbyJ STD
- This license type accepts connections from 4Ds. But it doesn't accept connections from any Java programs.
- JbyJ PRO
- This license type accepts connections from 4Ds. In addition, it accepts connections from Java programs in which the JbyJ class library is used.
JbyJ Terms
In this manual we use new terms JbyJ Server, JbyJ Client and Remote Method:
- JbyJ Server
- A JbyJ Server is a 4D using JbyJ, which accepts connections from other 4Ds or Java programs in a network. A JbyJ Server has the processes in which project methods requested by other 4Ds or Java programs are executed.
- JbyJ Client
- A JbyJ Client is a 4D using JbyJ or Java program using the JbyJ class library, which connects to a JbyJ Server in a network and calls its project methods.
- Remote Method
- A remote method is a 4D project method in a JbyJ Server. It is called from JbyJ Clients.
A 4D using JbyJ can be a JbyJ Server and a JbyJ Client simultaneously.
Method Group
The plug-in methods in JbyJ are classified into three groups as follows:
- JbyJ Server Methods
- These methods are used by a JbyJ Server.
- JbyJ Client Methods
- These methods are used by a JbyJ Client.
- Utilities
- These methods are used by both a JbyJ Server and Client.
JbJ Startserver ( ClientProcesses; OnConnected; OnDisconnected )--> Status [ C_LONGINT ]
Parameter
Type
Description
ClientProcesses
ARRAY LONGINT
Array whose elements are process numbers, inwhich methods requested by JbyJ Clients will be executed.
OnConnected
C_TEXT
Name of a method which is automatically called when a JbyJ Client opens a connection.
OnDisconnected
C_TEXT
Name of a method which is automatically called when a JbyJ Client closes the connection.
Call JbJ Start server to start accepting connections from JbyJ Clients.
In ClientProcesses, specify a long integer array or an integer array whose elements are process numbers, in which JbJ HANDLE CLIENT REQUESTSis called to execute methods requested by JbyJ Clients.
In OnConnected, specify the name of a method which will be automatically called in a JbyJ Server when JbJ Connect server or JbJ Connect server by servlet is called in a JbyJ Client. A client ID is passed to that method as a prameter by which the JbyJ Client can be identified. If you accept the connection from the JbyJ Client, return "True". If you refuse the connection, return "False".
In OnDisconnected, specify the name of a method which will be automatically called in a JbyJ Server when JbJ Disconnect server is called in a JbyJ Client. A client ID is passed to that method as a prameter by which the JbyJ Client can be identified. You need to return nothing in that method.
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Example Code
JbJ HANDLECLIENT REQUESTS
JbJ Getclient name ( ClientID ) --> UserName [ C_TEXT ]
Parameter
Type
Description
(No patameter)
JbJ HANDLE CLIENT REQUESTS handles requests of a JbyJ Client. Methods requested by the JbyJ Client are executed in this method.
Refer to Example Code for JbJ Start server.
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client namereturns the user name of the JbyJ Client identified by ClientID.
If any error occurred, this method returns "".
JbJ Getclient password ( ClientID ) --> Password [ C_TEXT ]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client passwordreturns the password of the JbyJ Client identified by ClientID.
If any error occurred, this method returns "".
JbJ Getclient structure name ( ClientID ) --> StructureFileName[ C_TEXT ]
JbJ Getclient data name ( ClientID ) --> DataFileName [ C_TEXT]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client structure name returns the structure file name of the JbyJ Client identified by ClientID. If the JbyJ client is a Java client, this method will return "Java".
If any error occurred, this method returns "".
JbJ Getclient address ( ClientID ) --> IPAddress [ C_TEXT ]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client data name returns the data file name of the JbyJ Client identified by ClientID. If the JbyJ client is a Java client, this method will return "Java".
If any error occurred, this method returns "".
JbJ Getclient port ( ClientID ) --> PortNumber [ C_LONGINT ]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client address returns the IP address or host name of the computer in which the JbyJ Client identified by ClientID is running.
If any error occurred, this method returns "".
JbJ Getclient process ( ClientID ) --> ProcessNumber [ C_LONGINT]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client port returns the port number of the JbyJ Client identified by ClientID.
If any error occurred, this method returns a negative number. Refer to Error Number.
JbJ Getclient id ( ProcessNo ) --> ClientID [ C_LONGINT ]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Get client process returns the process number in which methods requested by the JbyJ Client identified by ClientID will be executed.
If any error occurred, this method returns a negative number. Refer to Error Number.
Refer to JbJ Get client id.
JbJDisconnect client ( ClientID ) --> Status [ C_LONGINT ]
Parameter
Type
Description
ProcessNo
C_LONGINT
Process number
JbJ Get client id returns the client ID of the JbyJ Client whose requested methods will be executed in the process identified by ProcessNo .
If any error occurred, this method returns a negativenumber. Refer to Error Number.
Refer to JbJ Get client process.
JbJConnect server ( IPAddress; PortNo; UserName; Password )--> ServerID [ C_LONGINT ]
Parameter
Type
Description
ClientID
C_LONGINT
Client ID
JbJ Disconnect client closes the connection with the JbyJ Client identified by ClientID. In this case the connection is closed by a JbyJ Server. The JbyJ Client doesn't know that the connection is closed.
This method returns 0, if there is no error. If any erroroccurred, it returns a negative number. Refer to Error Number.
JbJConnect server by servlet ( ServletURL; IPAddress; PortNo;UserName; Password ) --> ServerID [ C_LONGINT ]
Parameter
Type
Description
IPAddress
C_TEXT
IP address or host name
PortNo
C_LONGINT
Port number
UserName
C_TEXT
User name
Password
C_TEXT
Password
JbJ Connect server establishes a connection with a JbyJ Server and returns a server ID by which the JbyJ Server is identified. The RMI protocal is used for this connection.
In IPAddress, specify an IP address or host name of the computer in which a JbyJ Server is runing.
In PortNo, specify a port number of the JbyJ Server.
In UserName, specify your user name.
In Password, specify your password.
If any error occurred, it returns a negative number. Refer to Error Number.
Refer to JbJ Connect server by servlet.
Refer to Example Code for JbJ Call remote method.
JbJ Callremote method ( ServerID; MethodName; Parameters; Async )--> Status [ C_LONGINT ]
Parameter
Type
Description
SevletURL
C_TEXT
URL of the JbyJAdaptor servlet
IPAddress
C_LONGINT
IP address or host name
PortNo
C_TEXT
Port number
UserName
C_TEXT
User name
Password
C_TEXT
Password
JbJ Connect server by servlet establishes a connection with a JbyJ Server via the JbyJAdaptor servlet and returns a server ID by which the JbyJ Server is identified.
This method uses two protocols HTTP/HTTPS and RMI for the connection because some firewalls block the RMI protocol. For this connection a HTTP server and the JbyJAdaptor servlet we provide are required. The JbyJAdaptor servlet in a HTTP server works as a mediator between HTTP/HTTPS and RMI.
In ServletURL, specify the URL of the JbyJAdaptor. The URL will be cromwellpsi.com or cromwellpsi.com:xxxx/JbyJAdaptor for example.
In IPAddress, specify an IP address or host name of the computer in which a JbyJ Server is running.
In PortNo, specify a port number of the JbyJ Server.
In UserName, specify your user name.
In Password, specify your password.
If any error occurred, it returns a negative number. Refer to Error Number.
Refer to JbJ Connect server.
Refer to Example Code for JbJ Call remote method.
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
MethodName
C_TEXT
Name of a remote method
Parameters
ARRAY POINTER
Pointer array whose elements point toparameters to be passed to a remote method
Async
C_LONGINT
0 or 1
JbJ Call remote method calls a remote method. Until the connection is closed, remote methods called by this method are executed in an exclusive process in the JbyJ Server. Therefore the process variables, the current record and the current selection are not changed between calls.
In ServerID, specify a ID number JbJ Connect server or JbJ Connect server by servlet returned.
In MethodName, specify a remote method name.
In Params, specify a pointer array whose elements point to parameters to be passed to the remote method. The results of the remote method are returned through Params. After the remote method is executed, the size of Params may be changed and its elements will point to the results returned by the remote method.
If 0 is specified in Async, the remote method is executed synchronously. If 1 is specified in Async, the remote method is executed asynchronously. If the remote method returns nothing, it can be executed asynchronously.
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Example Code
`Call remote methods ` C_LONGINT($ServerID) ` $ServerID:=JbJ Connect server ("cromwellpsi.com";;"Monica";"WhiteHouse") ` or $ServerID:=JbJ Connect server by servlet ( "cromwellpsi.com"; "cromwellpsi.com"; ; "Monica"; "WhiteHouse") If($ServerID>0) C_TEXT($StructureName;$DataName) ` $StructureName:=JbJ Get server structure name($ServerID) $DataName:=JbJ Get server data name($ServerID) ` C_BOOLEAN(vSex) C_TEXT(vName) C_LONGINT(vHisAge) C_LONGINT($Err) ` vSex:=True `Male vName:="Bill Clinton" ARRAY TEXT(aHisChildren;3) aHisChildren{1}:="John" aHisChildren{2}:="Mary" aHisChildren{3}:="Mike" ` ARRAY POINTER($Parameter;2) $Parameter{1}:=->vSex `1st parameter $Parameter{2}:=->vName `2nd parameter $Err:=JbJ Call remote method($ServerID;"TestMethod1";$Parameter;0) If($Err=0) If(Size of array($Parameter)=1) If(Type($Parameter{1}->)=Is LongInt) vHisAge:=$Parameter{1}-> `receive a result Else ALERT("Error:JbJ Call remote method") End if Else ALERT("Error:JbJ Call remote method") End if Else ALERT("Error:JbJ Call remote method") End if ` ARRAY POINTER($Parameter;3) $Parameter{1}:=->vSex `1st parameter $Parameter{2}:=->vName `2nd parameter $Parameter{3}:=->aHisChildren `3rd parameter $Err:=JbJ Call remote method($ServerID;"TestMethod2";$Parameter;0) If($Err=0) If(Size of array($Parameter)=1) If(Type($Parameter{1}->)=LongInt array) ARRAY LONGINT(aSalary;0) COPY ARRAY($Parameter{1}->;aSalary) `receive a result (array) Else ALERT("Error:JbJ Call remote method") End if Else ALERT("Error:JbJ Call remote method") End if Else ALERT("Error:JbJ Call remote method") End if ` ARRAY POINTER($Parameter;3) $Parameter{1}:=->vSex `1st parameter $Parameter{2}:=->vName `2nd parameter $Parameter{3}:=->aHisChildren `3rd parameter $Err:=JbJ Call remote method($ServerID;"TestMethod3";$Parameter;0) If($Err=0) If(Size of array($Parameter)=2) If(Type($Parameter{1}->)=Is LongInt) & (Type($Parameter{2}->)=LongInt array) vHisAge:=$Parameter{1}-> `receive the 1st result ARRAY LONGINT(aSalary;0) COPY ARRAY($Parameter{2}->;aSalary) `receive the 2nd result (array) Else ALERT("Error:JbJ Call remote method") End if Else ALERT("Error:JbJ Call remote method") End if Else ALERT("Error:JbJ Call remote method") End if ` $Err:=JbJ Disconnect server($ServerID) If($Err # 0) ALERT("Error:JbJ Disconnect server") End if ` Else ALERT("Error:JbJ Connect server") End if |
`"TestMethod1" in a JbyJ Server ` C_BOOLEAN($1) `Sex C_TEXT($2) `Name C_LONGINT($0) QUERY([Personnel];[Personnel]Sex=$1;*) QUERY([Personnel]; & ;[Personnel]Name=$2) $0:=[Personnel]Age |
`"TestMethod2" in a JbyJ Server ` C_BOOLEAN($1) `Sex C_TEXT($2) `Name C_POINTER($3) `His children ` C_LONGINT($Size;$x) $Size:=Size of array($3->) ARRAY TEXT(aHisChildren;$Size) For($x;1;$Size) aHisChildren{$x}:=$3->{$x} End for QUERY([Personnel];[Personnel]Sex=$1;*) QUERY([Personnel]; & ;[Personnel]Name=$2) RELATE MANY([Personnel]ID) ARRAY LONGINT(aSalary;0) SELECTION TO ARRAY([Salary]Paid;aSalary) ` C_POINTER($0) $0:=->aSalary |
`"TestMethod3" in a JbyJ Server ` C_BOOLEAN($1) `Sex C_TEXT($2) `Name C_POINTER($3) `His children ` C_LONGINT($Size;$x) $Size:=Size of array($3->) ARRAY TEXT(aHisChildren;$Size) For($x;1;$Size) aHisChildren{$x}:=$3->{$x} End for QUERY([Personnel];[Personnel]Sex=$1;*) QUERY([Personnel]; & ;[Personnel]Name=$2) RELATE MANY([Personnel]ID) ARRAY LONGINT(aSalary;0) SELECTION TO ARRAY([Salary]Paid;aSalary) ` ARRAY POINTER(aReturn;2) aReturn{1}:=->[Personnel]Age aReturn{2}:=->aSalary ` C_POINTER($0) $0:=->aReturn |
JbJDisconnect server ( ServerID ) --> Status [ C_LONGINT ]
JbJ Getserver structure name ( ServerID ) --> StructureFileName[C_TEXT]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Disconnect server terminates the connection with the JbyJ Server identified by ServerID.
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Refer to Example Code for JbJ Call remote method.
JbJ Getserver data name ( ServerID ) --> DataFileName [C_TEXT]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Get server structure name returns the structure file name of the JbyJ Server identified by ServerID.
If any error occurred, this method returns "".
JbJ Getservlet url ( ServerID ) --> ServletURL [C_TEXT]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Get server data name returns the data file name of the JbyJ Server identified by ServerID.
If any error occurred, this method returns "".
JbJ Getserver address ( ServerID ) --> IPAddress [C_TEXT]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Get servlet url returns the servlet URL, if the connection is established by JbJ Connect server by servlet. This method returns "", if the connection is established by JbJ Connect server.
If any error occurred, this method also returns "".
JbJ Getserver port ( ServerID ) --> PortNumber [ C_LONGINT ]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Get server address returns the IP address or host name of the computer in which the JbyJ Server identified by ServerID is running.
If any error occurred, this method returns "".
JbJ Getmy client id ( ServerID ) --> ClientID [ C_LONGINT ]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Get server portreturns the port number of the JbyJ Server identified by ServerID.
If any error occurred, this method returns a negativenumber. Refer to Error Number.
JbJ Getmy address --> IPAddress [C_TEXT]
Parameter
Type
Description
ServerID
C_LONGINT
Server ID
JbJ Get my client id returns the client ID by which this client is identified on the JbyJ Server identified by ServerID.
If any error occurred, this method returns a negative number. Refer to Error Number.
JbJ Getmy host name --> HostName [C_TEXT]
Parameter
Type
Description
(No patameter)
JbJ Get my addressreturns the IP address of your computer.
If any error occurred, this method returns "".
JbJCopy record to BLOB ( TableNo; BLOB ) --> Status [ C_LONGINT ]
Parameter
Type
Description
(No patameter)
JbJ Get my host namereturns the host name of your computer. If your computer has not a hostname, this method returns the IP address.
If any error occurred, this method returns "".
JbJCopy BLOB to record ( BLOB; TableNo )--> Status [C_LONGINT ]
Parameter
Type
Description
TableNo
C_LONGINT
Table number
BLOB
C_BLOB
BLOB in which the current record will be copied.
JbJ Copy record to BLOB copies the current record of a table whose number is passed in TableNo into BLOB.
If any error occurred, this method returns a negative number. Refer to Error Number.
JbJ Setenvironment ( JVM_ID; ProductType; PortNo ) --> Status [C_LONGINT ]
Parameter
Type
Description
BLOB
C_BLOB
BLOB in which a record has been copied.
TableNo
C_LONGINT
Table number
JbJ Copy BLOB to record replaces the current record of a table whose number is passed in TableNo with BLOB, in which a record has been copied by using JbJ Copy record to BLOB.
If any error occurred, this method returns a negative number. Refer to Error Number.
Parameter
Type
Description
JVM_ID
C_LONGINT
ID for a Java virtual machine JWD create java world returns
ProductType
C_TEXT
"PRODUCT" or "TRIAL"
PortNo
C_LONGINT
Port number
JbJ Set environment setups the environment for JbyJ. This method has to be executed before executing any other JbyJ plug-in methods. This method is usually called at "On Startup".
In JVM_ID, specify an ID number for a Java virtual machine which JWD create java world returns.
In ProductType, Specify "PRODUCT" normally. If you want to use your application with JbyJ in trial mode, specify "TRIAL".
In PortNo, specify a port number your JbyJ Server will use. We recommend to use 's for a JbyJ Server to avoid conflicting with other applications.
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Example Code
`Setup the environment for JbyJ in "On Startup" method ` C_LONGINT($JVM_ID) C_LONGINT($Err) ` $JVM_ID:=JWD Create java world("BUIT-IN") If($JVM_ID>0) $Err:=JbJ Set environment($JVM_ID;"PRODUCT";) If($Err # 0) ALERT("Error:JbJ Set environment") End if Else ALERT("Error:JWD Create java world") End if |
JWorld
JWD Createjava world ( JVM_Path )--> JVM_ID [ C_LONGINT ]
Parameter
Type
Description
JVM_Path
C_TEXT
"BUILT-IN", "" or a path to cromwellpsi.com (wondows)
JWD Create java world launches a Java virtual machine(JVM) and returns its ID number.
In Mac OS, JVM_Path is always ignored and Apple's system built-in JVM is launched. In Windows, specify "BUILT-IN", "" (blank) or a path to cromwellpsi.com in JVM_Path.
If "BUILT-IN" is specified in JVM_Path, JWorld's built-in JVM is launched. This built-in JVM is JRE Version 6 Update 18, which is located "Plugins/JWorld_cromwellpsi.com". If the built-in JVM is not found in the directory, it is considered that "" (blank) is specified in JVM_Path.
If "" (blank) is specified in JVM_Path, your installed JVM is launched referring to the Registry.
If a path to cromwellpsi.com is specified in JVM_Path, the JVM identified by the path is launched.
Example of the cromwellpsi.com in Windows JRE _02 "C:\ProgramFiles\Java\jre_02\bin\client\cromwellpsi.com" JDK _02 "C:\Program Files\Java\jdk_02\jre\bin\client\cromwellpsi.com" This plug-in method should be called in "On Startup" or in a process started in "On Server Startup".
This method returns a positive number (JVM_ID), if there isno error. If any error occurred, it returns a negative number. Refer toError Number.
Example Code
C_LONGINT($JVM_ID) C_LONGINT($Err) `ARRAY TEXT($Options;2)$Options{1}:="-XmsM"$Options{2}:="-XmxM" $Err:=JWD Set JVM options( $Options )If($Err=0) $JVM_ID:=JWD Create java world("BUILT-IN") If($JVM_ID>0) $Err:=JbJ Set environment($JVM_ID;"PRODUCT";) If($Err # 0) ALERT("Error:JbJ Set environment") End if Else ALERT("Error:JWD Create java world") End ifElse ALERT("Error:JWD Set JVM options")End if |
JWD Closejava world --> Status [ C_LONGINT ]
Parameter
Type
Description
(None)
JWD Close java world terminates JWorld. Call this method in "On Exit" or "On Server Shutdown".
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Example Code
JWD Convertline separator ( Switch ) --> Status [ C_LONGINT ]
Parameter
Type
Description
Switch
C_BOOLEAN
If Switch is True, Line separators are converted (CR <-> LF). If Switch is False, they are not converted.
If "True" is passed to JWD Convert line separator, all CRs (carriage return) are automatically converted to LFs (line feed) when 4D strings are sent to Java. And all LFs are automatically converted to CRs when Java strings are sent to 4D.
If "False" is passed to this method, any line separators are not converted.
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Example Code
JWD Set JVM options ( Options ) --> Status [ C_LONGINT ]
Parameter
Type
Description
Options
ARRAY TEXT
Text array whose elements are JVM options.
JWD Set JVM options sets Java virtual machine options. Pass a text array whose elements are the options. Call this method before JWD Create java world is executed. Refer to the following web page about JVM options:
cromwellpsi.com
If an option "cromwellpsi.comct=true" is set, stdout and stderr can be redirected to a file whose name is "cromwellpsi.com" which is located in the same level as the structure file.
This method returns 0, if there is no error. If any error occurred, it returns a negative number. Refer to Error Number.
Example Code
C_LONGINT($Err)C_LONGINT($JVM_ID)`ARRAY TEXT($Options;3)$Options{1}:="-XmsM"$Options{2}:="-XmxM"$Options{3}:="cromwellpsi.comct=true"` $Err:=JWD Set JVM options( $Options )If ($Err=0) $JVM_ID:=JWD Create java world( "" ) End if |
Java Class Library
cromwellpsi.com_cromwellpsi.com4DServer
cromwellpsi.com|
+cromwellpsi.com_cromwellpsi.com4DServer
A instance of this class is used as a stub of a JbyJ Server. This class has 2 constructors and 8 instance methods as follows:
JbyJ4DServer
public JbyJ4DServer(cromwellpsi.com ipaddress,
int portNo,
cromwellpsi.com userName,
cromwellpsi.com password)
throws cromwellpsi.com_cromwellpsi.comdLicenseCodeException,
cromwellpsi.com_cromwellpsi.comConnectionException,
cromwellpsi.com_cromwellpsi.comtryException,
cromwellpsi.comnHostException,
cromwellpsi.comException,
cromwellpsi.comndException,
cromwellpsi.commedURLException,
cromwellpsi.comption,
cromwellpsi.comion
By this constructor, a connection is established with a JbyJ Server identified by ipaddress and portNo. The RMI protocal is used for this connection.
In userName, specify your user name.
In password, specify your password.
This Java method corresponds with the plug-in method JbJ Connect server.
JbyJ4DServer
public JbyJ4DServer(cromwellpsi.com servletURL,
cromwellpsi.com ipaddress,
int portNo,
cromwellpsi.com userName,
cromwellpsi.com password)
throws cromwellpsi.com_cromwellpsi.comdLicenseCodeException,
cromwellpsi.com_cromwellpsi.comConnectionException,
cromwellpsi.com_cromwellpsi.comtryException,
cromwellpsi.comnHostException,
cromwellpsi.comException,
cromwellpsi.comndException,
cromwellpsi.commedURLException,
cromwellpsi.comption,
cromwellpsi.comion,
cromwellpsi.comotFoundException
By this constructor, a connection is established with a JbyJ Server identified by ipaddress and portNovia the servlet whose URL is specified in servletURL. HTTP/HTTPS and RMI are used for this connection in order to pass firewall.
In userName, specify your user name.
In password, specify your password.
This Java method corresponds with the plug-in method JbJ Connect server by servlet.
call4DMethod
public cromwellpsi.com call4DMethod(cromwellpsi.com methodName,
cromwellpsi.com[] parameter,
int async)
throws cromwellpsi.com_cromwellpsi.comtException,
cromwellpsi.com_cromwellpsi.comErrorException,
cromwellpsi.comnHostException,
cromwellpsi.comException,
cromwellpsi.comndException,
cromwellpsi.commedURLException,
cromwellpsi.comption,
cromwellpsi.comion
This method calls a remote method whose name is specified in methodName. Until the connection is closed, remote methods called by this Java method are executed in an exclusive process in the JbyJ Server. Therefore the process variables, the current record and the current selection are not changed between calls.
In parameter, specify an array of the Object class whose elements are parameters to be passed to the remote method. To pass values of primitive types (int, double), the wrapper objects must be created for them.
If 0 is specified in aync, the remote method is executed synchronously. If 1 is specified in aync, the remote method is executed asynchronously. If the remote method returns nothing, it can be executed asynchronously.
This Java method always returns an object of the Object class which corresponds with $0 in the remote method. The object will be unwrapped or cast to use in your program.
If the remote method returns a pointer to a ARRAY POINTER, this Java method returns an array of the Object class whose elements correspond with the elements of the ARRAY POINTER. The elements of the array will be unwrapped or cast to use in your program.
This Java method corresponds with the plug-in method JbJ Call remote method.
Refer to Type Conversion between 4D and Java.
disconnect
public void disconnect() throws cromwellpsi.com_cromwellpsi.comtException,
cromwellpsi.comnHostException,
cromwellpsi.comException,
cromwellpsi.comndException,
cromwellpsi.commedURLException,
cromwellpsi.comption
This method terminates the connection with the JbyJ Server.
This Java method corresponds with the plug-in method JbJ Disconnect server.
getStructureName
public cromwellpsi.com getStructureName()
getDataName
public cromwellpsi.com getDataName()
This method returns the data file name of the JbyJ Server.
This Java method corresponds with the plug-in method JbJ Get server data name.
getServletURL
public cromwellpsi.com getServletURL()
This method returns the URL of the servlet, if the connection is established using the servlet. This method returns "", if the connection is established not using the servlet.
This Java method corresponds with the plug-in method JbJ Get servlet url.
getAddress
public cromwellpsi.com getAddress()
This method returns the IP address or host name of the computer in which the JbyJ Server is running.
This Java method corresponds with the plug-in method JbJ Get server address.
getPort
public int getPort()
This method returns the port number of the JbyJ Server.
This Java method corresponds with the plug-in method JbJ Get server port.
getMyClientID
public int getMyClientID()
This method returns the client ID by which this client is identified on the JbyJ Server.
This Java method corresponds with the plug-in method JbJ Get my client id.
Example Code
import cromwellpsi.com*; import cromwellpsi.com_kobo.*; import cromwellpsi.com_cromwellpsi.com*; public class TestClass { /**************************/ // execute4Dmethod /**************************/ public void execute4Dmethod() { try{ // JbyJ4DServer server = new JbyJ4DServer( "cromwellpsi.com", // , // "Monica", // "Whitehouse" ); JbyJ4DServer server = new JbyJ4DServer( "cromwellpsi.com", "cromwellpsi.com", , "Monica", "Whitehouse" ); String structureName = server.getStructureName(); String dataName = server.getDataName(); Object[] params; Object[] results; Object resultObj; int hisAge; int[] hisSalary; boolean sex = true; //Male String name = "Bill Clinton"; String[] hisChildren = new String[ 3 ]; hisChildren[ 0 ] = "John"; hisChildren[ 1 ] = "Mary"; hisChildren[ 2 ] = "Mike"; params = new Object[ 2 ]; params[ 0 ] = new Boolean( sex ); // 1st Parameter params[ 1 ] = name; // 2nd Parameter resultObj = server.call4DMethod( "TestMethod1", params, 0 ); hisAge = ( (Integer)resultObj).intValue(); params = new Object[ 3 ]; params[ 0 ] = new Boolean( sex ); // 1st Parameter params[ 1 ] = name; // 2nd Parameter params[ 2 ] = hisChildren; // 3rd Parameter resultObj = server.call4DMethod( "TestMethod2", params, 0 ); hisSalary = (int[])resultObj; resultObj = server.call4DMethod("TestMethod3", params, 0 ); resultArray = (Object[])resultObj; hisAge = ( (Integer)( resultArray[ 0 ] ) ).intValue(); hisSalary = (int[])( resultArray[ 1 ] ); server.disconnect(); }catch( Exception e ) { cromwellpsi.comn( "" + e ); } } } |
Class cromwellpsi.com_cromwellpsi.com
cromwellpsi.com|
+cromwellpsi.com_cromwellpsi.com
This class corresponds with C_TIME in 4D and itsobjects are used when you pass parameters to 4D methods or receiveresults from them.
Time
public Time(int hour, int min, int sec)
This method creates an object of the Time class andinitializes its hour, minute and second with specified values.
getHours
public int getHours()
This method returns the hour of the Time object.
getMinutes
public int getMinutes()
This method returns the minute of the Time object.
getSeconds
public int getSeconds()
This method returns the second of the Time object.
setHours
public void setHours(int hour)
This method replaces the current hour of the Timeobject with a specified value.
setMinutes
public void setMinutes(int min)
This method replaces the current minute of the Timeobject with a specified value.
setSeconds
public void setSeconds(int sec)
This method replaces the current second of the Timeobject with a specified value.
Class cromwellpsi.com_cromwellpsi.com
cromwellpsi.com|
+cromwellpsi.com_cromwellpsi.com
How,,To,,Install,,iZotope,,Plug-ins,,amp;,,Use,,Keygen,,This,,is,,the,,Windows,,Keygen,,Link:,,If,,you,,have,,a,,Mac,. Align,It,V2,10,Keygen,By,Orion,-gt;gt;gt;,DOWNLOAD,(Mirror,1),1,,3. iZotope,Nectar,Production,Suite,-,Download,Patch,Keygen,LINK:. awayloadzone.
.What’s New in the 4D (4th Dimension) 6.0.5J serial key or number?
Screen Shot
System Requirements for 4D (4th Dimension) 6.0.5J serial key or number
- First, download the 4D (4th Dimension) 6.0.5J serial key or number
-
You can download its setup from given links: