Introduction to Studio
Studio offers features that help you develop applications rapidly, in a single, integrated environment including:
An editor in which to create
Classes, including persistent, database classes and Web service classes
Routines using ObjectScript
Support for teams of developers working with a common repository of application source code.
A graphical source code debugger.
The ability to organize application source code into projects.
Studio is a client application that runs on Windows-based operating systems. It can connect to any InterSystems server (compatible with the current version of Studio) regardless of what platform and operating system that server is using, and supports SSL/TLS-protected connections.
A Studio client must be running either the same version or a higher version of the InterSystems product that the InterSystems server is running.
Overview of the Studio Window
The main components of the Studio user interface are shown below:
Editor window: Class Editor for editing class definitions, Routine Editor for editing routines and include files, and CSP Editor for editing CSP definition text. Using CSP files with InterSystems IRIS® is not recommended.
Class Browser window: for viewing existing classes.
Workspace window: three tabs let you display the contents of the current project, all open windows, or the content of the current namespace.
Class Inspector window: for viewing and modifying keywords in a class definition.
Watch window: displays variables.
Title Bar: displays ConnectionName/Namespace@UserName - ProjectName.prj – Studio – ActiveDocument. If the active document is maximized, the name shows in square brackets.
In addition to the windows displayed above, Studio contains wizards and templates for assisting with common tasks. These include:
Find in Files window: displays a search window.
Output window: displays output from the InterSystems server (such as messages generated during class compilation).
Code Snippets window: for viewing and dragging user-created code snippets.
New Class wizard: defines a new class.
Class member wizards that add members to class definitions for: properties, indexes, relationships, methods, parameters, SQL triggers, queries, projections, storage, foreign keys, and XData blocks.
Wizards that create classes from other technologies; from: Java classes and jar files, SML schema, SOAP client classes, that provide access to COM objects, and DLL assembly files from .NET.
HTML templates that add: colors, tables, tags, and scripts.
CSP Form wizard: creates an HTML form bound to an object in a CSP page. Using CSP files with InterSystems IRIS is not recommended.
Visibility of Code
The Namespace tab of the Workspace window displays the code in the current namespace, with the following exceptions:
If you are in the %SYS namespace, all classes and routines are displayed, including classes and routines with names that start with %.
If you are in any other namespace, all classes and routines available in that namespace are visible by default, except for classes and routines with names that start with %. To display such classes and routines, select the Show System check box in the Open dialog box (File > Open).
Enabling Studio to Use Non-Latin1 Encoding
Because Studio uses non-Unicode encoding, in order to handle non-Latin1 character encoding, used for languages such as Russian, language encoding must be configured at the Windows OS level. Consult the Windows OS documentation for more information.
Studio uses projects to organize application source code.
A project is a set of class definitions, routines, and include files. For example, you might create a Studio project to group all classes for a single application.
You are always in a project, either one that you created or the default project that is created when you first open Studio. The default project is called Default_yourusername (a prefix of Default_ followed by your username).
All files in a single project must be in the same namespace (and on the same InterSystems server). Each class or routine can be associated with any number of projects. Each namespace can contain any number of projects.
The project stores information such as the class hierarchy in a given InterSystems namespace, used when you edit classes. The project also stores debugging information (such as how to start the application you want to debug).
A class definition defines a class. A class definition consists of class members (such as properties and methods) and other items, called keywords, each with associated values, that specify details of the class behavior.
Class definitions reside in a database where they are stored in the class dictionary. A class definition can be compiled, a process which creates executable code that can create object instances based on the class definition. The source code for the executable code created for a class consists of one or more routines. These generated routines can also be viewed in Studio.
A class definition can be projected for use by other technologies. In the case of SQL, this projection is automatic. In the case of Java, there is an additional compilation step in which a Java class is generated that corresponds to the class definition. For details, see the chapter “Adding Class Projections.”
Within Studio, class definitions can be displayed and edited in a Class Editor window. Class definitions can also be viewed in the Class Inspector window as keywords and their corresponding values in tables.
Using CSP files with InterSystems IRIS is not recommended.
In other InterSystems products, a CSP (Web Server Page) file is an HTML or XML text file containing CSP markup language. The CSP engine processes a CSP file and generates from it an InterSystems class which is then used to respond to HTTP events and provide Web content.
If you prefer a more programmatic approach to Web development, you can also use Studio to create and edit CSP classes in the same way as you would work with any other class definitions.
Studio displays CSP files in a CSP Editor window. This editor provides syntax coloring of HTML and XML as well as many of the scripting languages that may be contained in a CSP file.
The CSP Editor provides commands for performing common CSP and HTML editing tasks such as inserting CSP markup tags. Studio also lets you view the results of a CSP file by selecting View > Web Page.
Using the Routine Editor, you can directly create and edit the source for specific routines in a syntax-coloring editor. You also use the Routine Editor to edit include files.
Multiple User Support
Studio is an object-based, client-server application. The source files—class definitions, routines, and include files—that you can create and edit with Studio are stored in an InterSystems server and are represented as objects.
When you save a source file from Studio, it is saved in the InterSystems server you are connected to. If a source file is modified on the server while you are viewing it in Studio, you are notified and asked if you want to load the newer version.
Studio automatically detects when multiple users view the same source components simultaneously and manages access concurrency. If you attempt to open a file that is being edited by another user, you are notified and asked if you want to open the file in read-only mode.
Importing and Exporting Documents Locally
Normally any documents you work with in Studio (such as class definitions or routines) are stored in an InterSystems database (which may be on a remote machine). You can import from and export to local files using Tools > Export and Tools > Import.
Class definitions and routines are stored in local files as XML documents.
Studio includes a source-level, GUI debugger. The debugger attaches (or starts up and attaches to) a target process running on the same InterSystems server that Studio is connected to. The debugger controls this target process remotely and allows you to watch variables, step through code, and set breakpoints.
You typically must have a project open in order to use the debugger; the project contains the information needed to start the debug target (name of a routine, method, or client application). In addition, the project stores a list of breakpoints that were set in a prior debugging session.
You can attach and break into a running process without having a project open. In this case Studio does not remember breakpoint settings from previous sessions. See more about debugging in the chapter “Using the Studio Debugger.”
Debugging Object-Based Applications
At this time, Studio only allows source-level debugging of INT (ObjectScript routine). To step through, or set breakpoints within classes, open the corresponding INT and use the debugging commands in it.
To make sure that the generated source code for a class is available:
Select Tools > Options.
Navigate to Compiler > Flags & Optimization in the left-hand pane.
Select the Keep generated source code check box.
InterSystems security features control the use of Studio, the ability of Studio to connect to any InterSystems server, and support for SSL/TLS-protected connections. When you start Studio, it presents a login screen; to use Studio, you must log in as a user who holds the following privileges:
%Development:Use - Use permission on the %Development resource grants access to various development-related resources.
%Service_Object:Use - Use permission on the %Service_Object resource grants access to the %Service_Bindings service, which controls access to Studio.
Also, you can connect to a namespace only if you have Read or Write permission for its default database.
The way in which a user is granted these various privileges depends on the instance’s security level, as described in the following list.
For an instance with minimal security, all users, including UnknownUser, have all privileges and access to all namespaces. When presented with the Studio login screen, either leave the Username and Password fields blank or enter “_SYSTEM” and “SYS” as the username-password pair.
For an instance with normal security, you must be explicitly granted the specified privileges. This is established by being assigned to a role or roles that holds these privileges.
For an instance with locked-down security, the service that governs access to Studio (%Service_Bindings) is disabled by default. By default, no user has access to Studio.
To change Studio authentication settings:
Use the InterSystems IRIS launcher to open the Management Portal.
Select System Administration > Security > Services.
Click Go in the View or edit service definitions section.
Select or clear the check boxes under Allowed Authentication Methods.
Studio access may also be affected by any changes to default settings that have occurred since installation.
Source Control Hooks
Studio includes a mechanism for implementing custom hooks—code that is executed on the InterSystems server whenever a document is loaded or saved. Typically these hooks are used to implement a connection to a source or revision control system. Refer to Integrating InterSystems IRIS with Source Control Systems for more details.
Running Studio from the Command Line
You can run Studio from the system's command line using the command Cstudio.exe (in the install-dir\bin directory). The command and its parameters are case-sensitive.
|/Servername=ServerName||Connect to the server named ServerName.|
|/Server=cn_iptcp:127.0.0.1::||Connect to the server at ip address[port].|
|/Namespace=User||Connect to the User namespace. You must also define a server.|
|/Project=MyProject||Open project MyProject. You must also define a server and a namespace.|
|cn_iptcp://127.0.0.1:51773/User/test.int||Load routine test.int. cn_iptcp is a case sensitive protocol identifier.|
|/files="tag+1^myroutine.int",User.Class1.cls||Open listed documents and set cursor in specified position. You must also define a server and a namespace.|
|/pid=123||Attach to process. You must also define a server and a namespace.|
|/fastconnect=127.0.0.1:USER:_SYSTEM:SYS||Connect without connection definition in registry using ip address[port]:USER:username:password|