jsdai.lang
Class SdaiRepository

java.lang.Object
  extended byjsdai.lang.SdaiCommon
      extended byjsdai.lang.SdaiRepository
All Implemented Interfaces:
QuerySource, SdaiEventSource

public abstract class SdaiRepository
extends jsdai.lang.SdaiCommon
implements SdaiEventSource, QuerySource

An SdaiRepository is the physical container to store persistently:
- SdaiModels with entity instances within them;
- SchemaInstances which logically group SdaiModels.
Throughout this documentation repository is used as a synonym for SdaiRepository.

Conceptionally, the SdaiRepository can be represented by the following EXPRESS entity:

ENTITY SdaiRepository;
  name : String;
  location : OPTIONAL Object;
  description : LIST [1:?] OF String;
  models       : SET [0:?] OF SdaiModel;
  schemas      : SET [0:?] OF SchemaInstance;
  changeDate : String;
  author       : LIST [1:?] OF String;
  organization       : LIST [1:?] OF String;
  preprocessorVersion : String;
  originatingSystem : String;
  authorization : String;
  defaultLanguage : OPTIONAL String;
  contextIdentifiers     : LIST [0:?] OF String;
INVERSE
  session  : SdaiSession FOR knownServers;
UNIQUE
  UR1: name, session;
END_ENTITY;

The attributes description, author, organization, defaultLanguage and contextIdentifiers are read-write, whereas all other attributes are read-only. For each attribute a corresponding get method (or methods in the case of changeDate) is defined. The changeDate can be retrieved either as String or as long. The attributes preprocessorVersion, originatingSystem, authorization and defaultLanguage also have corresponding set methods.

The persistent storage is realized through the special directories containing binary data files. For every SdaiRepository a corresponding directory with the SdaiRepository name exists. By default these directories are placed into a special repositories-directory in the local file system. This is specified by the property "repositories" in the configuration file jsdai.properties.

Example:

    repositories=D:\\repos
Other locations are also possible. A user should never manipulate these directories and binary data files. An access to them is allowed only through the JSDAI methods.

In general, the repositories can be accessed from either the local file system or remotely from a JSDAI-Server. After opening a session all repositories are closed, except a special one named "SystemRepository" which contains dictionary and mapping data. Each model in this repository can be at most read-only, that is, an attempt to set read-write mode to such models will lead to an SdaiException. Repositories can be opened with openRepository() and closed with closeRepository() method.

Repositories are mainly selected by SdaiSession.getKnownServers() to get all available repositories or by SdaiSession.getActiveServers() to get only the currently open ones. Initially, after openSession(), the set returned by getKnownServers() contains all SdaiRepositories located in the special repositories-directory. The remote repositories or repositories located at other places on the file system can be added to the known servers with linkRepository() method. New repositories are created with the SdaiSession methods createRepository() and importClearTextEncoding(). No longer needed repositories are removed with deleteRepository() method.

Each repository has a unique non-empty name for identification. The name is assigned by createRepository() or importClearTextEncoding() methods and cannot be changed afterwards. During creation of a repository an empty string can be passed to the name parameter to signal JSDAI to create a temporary repository. The name of the local repository can consist only of the following characters: upper case letters from 'A' to 'Z', lower case letters from 'a' to 'z', digits '0', '1',..., '9' and underscore '_'. Moreover, the name must start from a letter. If in importClearTextEncoding() method the repository name is extracted from the header of the imported file, this name is corrected to conform the above rules. In the case of the remote repository, its name, in addition, is allowed to contain the following characters: "file://", "/" and ".".

The repositories need to be located somewhere. The location is either
- local in the default repositories-directory;
- local in the specified directory as SDAI file;
- remote on a JSDAI-Server;
- unknown in the case of a degenerated repository (see below).

The actual location can be accessed with getLocation() method. By default the repositories are created locally in the specific repositories-directory. But it is possible to put repositories in other places, either locally or remotely. Locally, on an available file system by specifying a path during creation, or remotely by specifying the domain or INET of the JSDAI-Server. However, only repositories located in the default repositories-directory are by default available after openSession(). The location of a repository cannot be changed once it is created except for that the location gots invalid.

It is not possible to create a repository on an unknown location. But a repository may contain instances which reference other instances in other repositories which do not belong to knownServers.
In this case only the name of the referenced repositories is known, but not their location. We call them degenerated repositories. Trying to open a degenerated repository results in the SdaiException "RP_NAVL - Repository not available". If getLocation() is applied to such a repository, then the SdaiException "VA_NEXS - Value does not exist" is thrown. The degenerated repositories can be promoted to ordinary repositories with importClearTextEncoding() or linkRepository() methods by using the same repository name.

With linkRepository() method it is possible to link local or remote repositories to the current session. With unlinkRepository() closed and for the user not needed repositories can be made unknown to the current session.

The methods createRepository(), importClearTextEncoding() and linkRepository() have parameters for the repository name and the repository location. The following combinations of values for these parameters are allowed:

1) null, xxx : This is possible only for importClearTextEncoding() method. If this case happens, the repository name is taken from the entity file_name in the header of an exchange structure from which the encoding is imported.

2) String1, xxx: String1 is used as the repository name.

3) "", null : A temporary repository is created with an artificial name. Temporary repositories are automatically removed during closeSession() and are not available after the next openSession().

4) xxx, String2: The repository is created at the location indicated by String2. If String2 ends with ".sdai" then repository stored in SDAI file is created. If String2 ends with ".sdai" and the first parameter is null or empty string then repository name is derived from SDAI file name.

5) String1, String2: String1 is the name of a remote repository. String2 is the username and password with the prefix "//" and the last character "@". Example: "//guest:passwd@". A server for remote access should be named by prefixing it with "//" and giving the domain name. Example: Repository "test1" on the domain "lksoft.de" has to be named "//test1.lksoft.de".

Repositories have two sets of attributes: header properties and contents.
The header properties are the following:
- description
- time_stamp
- author
- organization
- preprocessor_version
- originating_system
- authorization
- default_language
- context_identifiers.
The contents consists of:
- models
- schemas.

To access the header properties for reading, the repository must be opened. To modify the header attributes, a read-write transaction has to be started additionally.

To access the contents data, the repository must be opened and either a read-only or a read-write transaction has to be started. When transaction access is ended, the contents of a repository is no longer available. The repository contents cannot be manipulated directly by an application. Manipulations are only possible with the following methods:
- createSdaiModel()
- deleteSdaiModel()
- renameSdaiModel()
- createSchemaInstance()
- delete() (in class SchemaInstance).

See Also:
"ISO 10303-22::7.4.3 sdai_repository and 7.4.4 sdai_repository_contents"

Method Summary
 void addSdaiListener(SdaiListener listener)
          Adds SdaiListener extending java.util.EventListener to a special aggregate in this repository.
 boolean checkCreateSchemaInstance(java.lang.Class nativeSchema)
          Returns false if the owning session is not permitted to create a new schema instance in this repository for specified native schema.
 boolean checkCreateSchemaInstance(jsdai.dictionary.ESchema_definition nativeSchema)
          Returns false if the owning session is not permitted to create a new schema instance in this repository for specified native schema.
 boolean checkCreateSdaiModel(java.lang.Class underlyingSchema)
          Returns false if the owning session is not permitted to create a new model in this repository with specified underlying schema.
 boolean checkCreateSdaiModel(jsdai.dictionary.ESchema_definition underlyingSchema)
          Returns false if the owning session is not permitted to create a new model in this repository with specified underlying schema.
abstract  SdaiPermission checkPermission()
          Returns this repository effective permission which determines the repository's access rights.
abstract  void checkRead()
          Throws SdaiException.SY_SEC if the owning session has no read access to this repository.
abstract  void checkWrite()
          Throws SdaiException.SY_SEC if the owning session has no write access to this repository.
 void closeRepository()
          Closes this repository.
 void copyFrom(ASchemaInstance aSourceSchemaInstance)
          Makes a copy of all instances from the specified schema instance aggregate to this repository.
 void copyFrom(SchemaInstance sourceSchemaInstance)
          Makes a copy of all instances from the specified schema instance to this repository.
 void copyFrom(SdaiRepository sourceRepository)
          Makes a copy of all models together with instances and schema instances from the specified repository to this repository.
abstract  SchemaInstance createSchemaInstance(java.lang.String name, java.lang.Class schema)
          Creates a new SchemaInstance in this repository.
abstract  SchemaInstance createSchemaInstance(java.lang.String name, jsdai.dictionary.ESchema_definition schema)
          Creates a new SchemaInstance in this repository.
abstract  SdaiModel createSdaiModel(java.lang.String model_name, java.lang.Class schema)
          Creates a new SdaiModel in this repository.
abstract  SdaiModel createSdaiModel(java.lang.String model_name, jsdai.dictionary.ESchema_definition schema)
          Creates a new SdaiModel in this repository.
 void deleteRepository()
          Deletes this repository.
 void exportClearTextEncoding(java.io.OutputStream location)
          Creates a STEP file in a form of the exchange structure containing the data of this repository.
 void exportClearTextEncoding(java.io.OutputStream location, java.lang.String file_name)
          Creates a STEP file in a form of the exchange structure containing the data of this repository.
 void exportClearTextEncoding(java.lang.String location)
          Creates a STEP file in a form of the exchange structure containing the data of this repository.
 void exportClearTextEncoding(java.lang.String location, java.lang.String file_name)
          Creates a STEP file in a form of the exchange structure containing the data of this repository.
 void exportXml(java.io.OutputStream location, InstanceReader instanceReader)
          Writes this repository in XML representation to specified stream.
abstract  SchemaInstance findSchemaInstance(java.lang.String name)
          Given a name, finds the SchemaInstance with this name in this repository.
abstract  SdaiModel findSdaiModel(java.lang.String name)
          Given a name, finds the SdaiModel with this name in this repository.
 A_string getAuthor()
          Returns an aggregate of strings A_string identifying the person responsible for creating this repository.
 java.lang.String getAuthorization()
          Returns a String containing the name and mailing address of the person who authorizes sending of the exchange structure exported from this repository.
 java.lang.String getChangeDate()
          Returns the date and time specifying when this repository was created or most recently modified.
 long getChangeDateLong()
          Returns long value of the date and time specifying when this repository was created or most recently modified.
 A_string getContextIdentifiers()
          Returns an aggregate A_string containing information describing the contexts within which the instances of the models in this repository are applicable.
 java.lang.String getDefaultLanguage()
          Returns a String identifying the default language for string values in those models of this repository, for which their own default language is not specified.
 A_string getDescription()
          Returns an aggregate of strings A_string containing optional descriptions about the SdaiRepository.
 java.lang.String getId()
          Returns repository identifier as a String.
 EEntity getInstanceByRef(jsdai.query.SerializableRef entityRef)
          Returns remote EEntity using specified entity reference.
 java.lang.String getLocation()
          Returns the location of the repository as a String.
 java.lang.String getLockingUser()
          Returns the name of the user that has placed exclusive lock on remote repository.
 ASdaiModel getModels()
          Returns a read-only aggregate of all the SdaiModels of this repository.
 java.lang.String getName()
          Returns the name of the repository as a String.
 A_string getOrganization()
          Returns an aggregate of strings A_string containing the organizations with whom the author of this repository is associated.
 java.lang.String getOriginatingSystem()
          Returns a String characterizing the system from which the data contained in this repository are originated.
 long getPersistentLabel()
          Returns current persistent label.
 java.lang.String getPreprocessorVersion()
          Returns a String characterizing the system used to create this repository.
 ASdaiModel getQuerySourceDomain()
          Returns domain in which to perform a search.
 jsdai.query.SerializableRef getQuerySourceDomainRef()
           
 jsdai.query.SerializableRef getQuerySourceInstanceRef()
           
 AEntity getQuerySourceInstances()
          Returns starting instances which serve as the first input instance set for a query.
 java.lang.String getRealName()
          Returns the real (without recurrence number) name of the repository as a String.
 SchemaInstance getSchemaInstanceByRef(jsdai.query.SerializableRef schemaRef)
          Returns remote SchemaInstance using specified schema instance reference.
 ASchemaInstance getSchemas()
          Returns a read-only aggregate of all SchemaInstances of this repository.
 SdaiModel getSdaiModelByRef(jsdai.query.SerializableRef modelRef)
          Returns remote SdaiModel using specified model reference.
 SdaiSession getSession()
          Returns the only one SdaiSession object.
abstract  EEntity getSessionIdentifier(java.lang.String label)
          Returns entity instance for the given persistent label.
 void importXml(java.io.InputStream location)
          Reads repository from specified stream as XML representation.
 boolean isActive()
          Informs if this repository is open.
 boolean isModified()
          Informs if this repository is modified.
abstract  void openRepository()
          Makes the SdaiModels and SchemaInstances contained in this repository available for subsequent access.
 int query(java.lang.String where, EEntity entity, AEntity result)
          This method is not implemented in current JSDAI version.
 void removeSdaiListener(SdaiListener listener)
          Removes SdaiListener extending java.util.EventListener from the special aggregate in this repository.
 void setAuthorization(java.lang.String value)
          Assigns a String value to the attribute characterizing the person who authorizes sending of the exchange structure exported from this repository.
 void setDefaultLanguage(java.lang.String value)
          Assigns a String to the attribute identifying the default language for string values in those models of this repository, for which their own default language is not specified.
 void setLocation(java.lang.String location)
          Assigns a String value to the location attribute of the repository.
abstract  void setNextPersistentLabel(long newPersistentLabel)
          Assigns a long value to the next persistent label, which will be used for the next instance.
 void setOriginatingSystem(java.lang.String value)
          Assigns a String value to the attribute characterizing the system from which the data contained in this repository are originated.
 void setPreprocessorVersion(java.lang.String value)
          Assigns a String value to the attribute characterizing the system used to create this repository.
 void shortNameSupport(boolean enable)
          Selects to write entity names either in usual form or in short form.
 java.lang.String toString()
          Returns a description of this repository as a String.
 void unlinkRepository()
          Removes the repository from the current session, but does not delete it physically.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
                         throws SdaiException
Returns the name of the repository as a String.

The repositories known to an SdaiSession must have unique names. An exception will be thrown if the repository is deleted or if the SdaiSession is closed.

Returns:
the name of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.

getId

public java.lang.String getId()
                       throws SdaiException
Returns repository identifier as a String.

The repositories within a SdaiSession have unique identifiers, which are not reused when some repositories are deleted and some new created or imported.

Returns:
the identifier of this SdaiRepository.
Throws:
SdaiException - RP_NEXS, repository does not exist.

getLocation

public java.lang.String getLocation()
                             throws SdaiException
Returns the location of the repository as a String. This is either
- null for unknown location or
- a path within a locally available file system or
- when starting with the prefix "//", the INET or domain of a remote JSDAI-Server. If the repository is degenerated, then SdaiException VA_NEXS is thrown.

Returns:
the location of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - VA_NEXS, value does not exist.

unlinkRepository

public void unlinkRepository()
                      throws SdaiException
Removes the repository from the current session, but does not delete it physically. As a result, the Java object, representing the repository becomes invalid and this object is no longer included in SdaiSession.knownServers. The physical repository however remains intact and can later accessed again with linkRepository. This method can be applied only to closed repositories. If the repository is degenerated, then SdaiException FN_NAVL is thrown.

This method is an extension of JSDAI, which is not a part of the standard.

Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_OPN, repository open.
SdaiException - RP_NAVL, repository not available.
SdaiException - FN_NAVL, function not available.
See Also:
SdaiSession.linkRepository(java.lang.String, java.lang.String)

getDescription

public A_string getDescription()
                        throws SdaiException
Returns an aggregate of strings A_string containing optional descriptions about the SdaiRepository.

After invocation of SdaiSession method createRepository this aggregate is always empty, whereas after invocation of importClearTextEncoding it contains strings taken from the field description of the entity file_description in the header of the exchange structure (see ISO 10303-21::8.2.1 file_description). That is, this aggregate always exists, but may be empty. During a read-write transaction the aggregate can be modified by adding/modifying/removing its members. When applying exportClearTextEncoding, the content of this aggregate will be written to the exchange structure created by the method being applied. The method is available only if the repository is open.

Returns:
aggregate containing informal description of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
"ISO 10303-21::8.2.1 file_description."

getSession

public SdaiSession getSession()
                       throws SdaiException
Returns the only one SdaiSession object. If session is closed, SdaiException RP_NEXS is thrown.

Returns:
the current session.
Throws:
SdaiException - RP_NEXS, repository does not exist.

getModels

public ASdaiModel getModels()
                     throws SdaiException
Returns a read-only aggregate of all the SdaiModels of this repository. The aggregate is automatically updated when new models are created with createSdaiModel or removed by deleteSdaiModel. The models of a repository are only accessible if the repository is open.

Returns:
aggregate containing all models of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - VA_NSET, value not set.
See Also:
openRepository()

getSchemas

public ASchemaInstance getSchemas()
                           throws SdaiException
Returns a read-only aggregate of all SchemaInstances of this repository. The aggregate is automatically updated when new schema instances are created with createSchemaInstance or removed by delete. The schema instances of a repository are only accessible if the repository is open.

Returns:
aggregate containing all schema instances of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - VA_NSET, value not set.
See Also:
openRepository()

getChangeDate

public java.lang.String getChangeDate()
                               throws SdaiException
Returns the date and time specifying when this repository was created or most recently modified. The format of this description is specified in ISO 8601 (for details, see ISO 10303-21::9.2.2 file_name).

The time stamp is updated each time when commit method is applied, provided either the repository has been modified since the most recent commit or abort operation was performed, or no such operation was performed thus far but the repository was established by createRepository method. If, however, for the repository no such case has appeared, then the time stamp is set as follows. If the repository was introduced by createRepository method, then the time of its creation is taken. The same rule applies also to the "SystemRepository". If the repository was created using importClearTextEncoding method, then the time stamp is borrowed from the entity file_name in the header of an exchange structure from which the encoding was imported. Finally, if the repository was established using linkRepository method, then the time stamp is extracted from the data of the repository linked to the session. The method is available only if the repository is open.

Example of the time stamp:

    Calendar date: 28 June 2000
    Time of the day: 15 minutes 12 seconds past 17 hours
    Above date and time encoded according to ISO 8601:
        2000-06-28T17:15:12

Returns:
time stamp of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
getChangeDateLong(), SdaiTransaction.commit(), SdaiSession.createRepository(java.lang.String, java.lang.Object), SdaiSession.importClearTextEncoding(java.lang.String, java.lang.Object, java.lang.Object), SdaiSession.linkRepository(java.lang.String, java.lang.String), "ISO 10303-21::9.2.2 file_name."

getChangeDateLong

public long getChangeDateLong()
                       throws SdaiException
Returns long value of the date and time specifying when this repository was created or most recently modified. This value is updated each time when commit method is applied, provided either the repository has been modified since the most recent commit or abort operation was performed, or no such operation was performed thus far but the repository was established by createRepository method. If, however, for the repository no such case has appeared, then this value is set as follows. If the repository was introduced by createRepository method, then the time of its creation is taken. The same rule applies also to the "SystemRepository". If the repository was created using importClearTextEncoding method, then the date is borrowed from the entity file_name in the header of an exchange structure from which the encoding was imported. Finally, if the repository was established using linkRepository method, then the date is extracted from the data of the repository linked to the session.

If time value is obtained as a string from an exchange structure processed by importClearTextEncoding method and this string violates the rules for time stamps stated in "ISO 10303-21::8.2.2", then SdaiException VA_NVLD is thrown. The method is available only if the repository is open.

Returns:
a long representing the date and time.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - VA_NVLD, value invalid.
See Also:
getChangeDate(), SdaiTransaction.commit(), SdaiSession.createRepository(java.lang.String, java.lang.Object), SdaiSession.importClearTextEncoding(java.lang.String, java.lang.Object, java.lang.Object), SdaiSession.linkRepository(java.lang.String, java.lang.String), "ISO 10303-21::8.2.2 file_name."

getAuthor

public A_string getAuthor()
                   throws SdaiException
Returns an aggregate of strings A_string identifying the person responsible for creating this repository. The aggregate shall have its name at the first position and mail and/or email addresses at the following positions.

After invocation of SdaiSession method createRepository this aggregate is always empty, whereas after invocation of importClearTextEncoding it contains strings taken from the field author of the entity file_name in the header of the exchange structure (see ISO 10303-21::8.2.2 file_name). That is, this aggregate always exists, but may be empty. During a read-write transaction the aggregate can be modified by adding/modifying/removing its members. It is a responsibility of the application to fill this aggregate with useful information. When applying exportClearTextEncoding, the content of this aggregate will be written to the exchange structure created by the method being applied. The method is available only if the repository is open.

Returns:
aggregate identifying an author of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
"ISO 10303-21::8.2.2 file_name."

getOrganization

public A_string getOrganization()
                         throws SdaiException
Returns an aggregate of strings A_string containing the organizations with whom the author of this repository is associated.

After invocation of SdaiSession method createRepository this aggregate is always empty, whereas after invocation of importClearTextEncoding it contains strings taken from the field organization of the entity file_name in the header of the exchange structure (see ISO 10303-21::8.2.2 file_name). That is, this aggregate always exists, but may be empty. During a read-write transaction the aggregate can be modified by adding/modifying/removing its members. It is a responsibility of the application to fill this aggregate with useful information. When applying exportClearTextEncoding, the content of this aggregate will be written to the exchange structure created by the method being applied. The method is available only if the repository is open.

Returns:
aggregate that lists organizations an author of this repository is associated.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
"ISO 10303-21::8.2.2 file_name."

getPreprocessorVersion

public java.lang.String getPreprocessorVersion()
                                        throws SdaiException
Returns a String characterizing the system used to create this repository.

After invocation of SdaiSession method createRepository some default value to this string is assigned, whereas after invocation of importClearTextEncoding this string has value taken from the field preprocessor_version of the entity file_name in the header of the exchange structure (see ISO 10303-21::8.2.2 file_name). The method is available only if the repository is open.

Returns:
string describing the system used to create this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
setPreprocessorVersion(java.lang.String), "ISO 10303-21::8.2.2 file_name."

setPreprocessorVersion

public void setPreprocessorVersion(java.lang.String value)
                            throws SdaiException
Assigns a String value to the attribute characterizing the system used to create this repository. This assignment is allowed only if the repository is open. When applying exportClearTextEncoding, the value assigned will be written to the exchange structure created by the method being applied.

Parameters:
value - string describing the system used to create this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - VA_NSET, value not set.
See Also:
getPreprocessorVersion(), openRepository(), "ISO 10303-21::8.2.2 file_name."

getOriginatingSystem

public java.lang.String getOriginatingSystem()
                                      throws SdaiException
Returns a String characterizing the system from which the data contained in this repository are originated.

After invocation of SdaiSession method createRepository some default value to this string is assigned, whereas after invocation of importClearTextEncoding this string has value taken from the field originating_system of the entity file_name in the header of the exchange structure (see ISO 10303-21::8.2.2 file_name). The method is available only if the repository is open.

Returns:
string describing the system that is a source of the data in this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
setOriginatingSystem(java.lang.String), "ISO 10303-21::8.2.2 file_name."

setOriginatingSystem

public void setOriginatingSystem(java.lang.String value)
                          throws SdaiException
Assigns a String value to the attribute characterizing the system from which the data contained in this repository are originated. This assignment is allowed only if the repository is open. When applying exportClearTextEncoding, the value assigned will be written to the exchange structure created by the method being applied.

Parameters:
value - string describing the system that is a source of the data in this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - VA_NSET, value not set.
See Also:
getOriginatingSystem(), openRepository(), "ISO 10303-21::8.2.2 file_name."

getAuthorization

public java.lang.String getAuthorization()
                                  throws SdaiException
Returns a String containing the name and mailing address of the person who authorizes sending of the exchange structure exported from this repository.

After invocation of SdaiSession method createRepository some default value to this string is assigned, whereas after invocation of importClearTextEncoding this string has value taken from the field authorization of the entity file_name in the header of the exchange structure (see ISO 10303-21::8.2.2 file_name). The method is available only if the repository is open.

Returns:
string describing the person who authorizes sending of the exchange structure.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
setAuthorization(java.lang.String), "ISO 10303-21::8.2.2 file_name."

setAuthorization

public void setAuthorization(java.lang.String value)
                      throws SdaiException
Assigns a String value to the attribute characterizing the person who authorizes sending of the exchange structure exported from this repository. This assignment is allowed only if the repository is open. When applying exportClearTextEncoding, the value assigned will be written to the exchange structure created by the method being applied.

Parameters:
value - string describing the person who authorizes sending of the exchange structure.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - VA_NSET, value not set.
See Also:
getAuthorization(), openRepository(), "ISO 10303-21::8.2.2 file_name."

getDefaultLanguage

public java.lang.String getDefaultLanguage()
                                    throws SdaiException
Returns a String identifying the default language for string values in those models of this repository, for which their own default language is not specified. More precisely, for a model, the default language can be assigned individually. String returned by this method serves as a default language for those models for which an individual assignment was not made.

After invocation of SdaiSession method createRepository this string is set to null, whereas after invocation of importClearTextEncoding this string can take value extracted from the header of the exchange structure (see ISO 10303-21::8.2.4 section_language) provided an appropriate value is given there (otherwise it is set to null). The method is available only if the repository is open.

Returns:
String identifying the default language for string values in models of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
setDefaultLanguage(java.lang.String), SdaiModel.getDefaultLanguage(), SdaiModel.setDefaultLanguage(java.lang.String), "ISO 10303-21::8.2.4 section_language."

setDefaultLanguage

public void setDefaultLanguage(java.lang.String value)
                        throws SdaiException
Assigns a String to the attribute identifying the default language for string values in those models of this repository, for which their own default language is not specified. This assignment is allowed only if the repository is open. If at least one model in this repository does not have its own default language and the default language of the repository is set with some value, then when applying exportClearTextEncoding, this value will be written to the exchange structure created by the method being applied.

Parameters:
value - String identifying the default language for string values in models of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
getDefaultLanguage(), SdaiModel.getDefaultLanguage(), SdaiModel.setDefaultLanguage(java.lang.String), openRepository(), "ISO 10303-21::8.2.4 section_language."

getContextIdentifiers

public A_string getContextIdentifiers()
                               throws SdaiException
Returns an aggregate A_string containing information describing the contexts within which the instances of the models in this repository are applicable. Both the repository and each model in it have their own aggregates A_string for writing context identifiers. But for those models, for which their own aggregate is empty, contexts are described by the aggregate returned by this method, that is, by the repository aggregate.

After invocation of SdaiSession method createRepository this aggregate is empty, whereas after invocation of importClearTextEncoding this aggregate will contain information extracted from the header of the exchange structure (see ISO 10303-21::8.2.5 section_context) provided an appropriate information is given there. That is, this aggregate always exists, but may be empty. During a read-write transaction the aggregate can be modified by adding/modifying/removing its members. If for at least one model in this repository its own aggregate describing contexts is empty and the repository aggregate contains at least one string, then when applying exportClearTextEncoding, the content of this aggregate will be written to the exchange structure created by the method being applied. The method is available only if the repository is open.

Returns:
aggregate containing information describing the contexts.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
See Also:
SdaiModel.getContextIdentifiers(), "ISO 10303-21::8.2.5 section_context."

shortNameSupport

public void shortNameSupport(boolean enable)
                      throws SdaiException
Selects to write entity names either in usual form or in short form. For the latter alternative the parameter value shall be set to true. This information is used by exportClearTextEncoding and CEntity.toString methods. Invocation of the method is allowed only if the repository is open.

This method is an extension of JSDAI, which is not a part of the standard.

Parameters:
enable - shows whether entity names must be short (if true) or usual (if false).
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.

checkPermission

public abstract SdaiPermission checkPermission()
                                        throws SdaiException
Returns this repository effective permission which determines the repository's access rights.

Returns:
the effective permission
Throws:
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkRead(), checkWrite(), SdaiPermission

checkRead

public abstract void checkRead()
                        throws SdaiException
Throws SdaiException.SY_SEC if the owning session has no read access to this repository. Otherwise this method returns with no action.

Throws:
SdaiException - SY_SEC if the owning session is not granted the read access
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkPermission(), checkWrite(), SdaiPermission

checkWrite

public abstract void checkWrite()
                         throws SdaiException
Throws SdaiException.SY_SEC if the owning session has no write access to this repository. Otherwise this method returns with no action.

Throws:
SdaiException - SY_SEC if the owning session is not granted the write access
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkPermission(), checkRead(), SdaiPermission

checkCreateSchemaInstance

public boolean checkCreateSchemaInstance(jsdai.dictionary.ESchema_definition nativeSchema)
                                  throws SdaiException
Returns false if the owning session is not permitted to create a new schema instance in this repository for specified native schema. Otherwise, if schema instance could be created, it returns true.

Parameters:
nativeSchema - the native EXPRESS schema
Returns:
false if the owning session is permitted to create a new schema instance; true otherwise.
Throws:
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkCreateSchemaInstance(Class)

checkCreateSchemaInstance

public boolean checkCreateSchemaInstance(java.lang.Class nativeSchema)
                                  throws SdaiException
Returns false if the owning session is not permitted to create a new schema instance in this repository for specified native schema. Otherwise, if schema instance could be created, it returns true.

Parameters:
nativeSchema - the native EXPRESS schema class
Returns:
false if the owning session is permitted to create a new schema instance; true otherwise.
Throws:
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkCreateSchemaInstance(ESchema_definition)

checkCreateSdaiModel

public boolean checkCreateSdaiModel(jsdai.dictionary.ESchema_definition underlyingSchema)
                             throws SdaiException
Returns false if the owning session is not permitted to create a new model in this repository with specified underlying schema. Otherwise, if model could be created, it returns true.

Parameters:
underlyingSchema - the underlying EXPRESS schema
Returns:
false if the owning session is permitted to create a new model; true otherwise.
Throws:
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkCreateSdaiModel(Class)

checkCreateSdaiModel

public boolean checkCreateSdaiModel(java.lang.Class underlyingSchema)
                             throws SdaiException
Returns false if the owning session is not permitted to create a new model in this repository with specified underlying schema. Otherwise, if model could be created, it returns true.

Parameters:
underlyingSchema - the underlying EXPRESS schema class
Returns:
false if the owning session is permitted to create a new model; true otherwise.
Throws:
SdaiException - if an error occurs performing underlying JSDAI operations
Since:
4.0.1
See Also:
checkCreateSdaiModel(ESchema_definition)

getLockingUser

public java.lang.String getLockingUser()
                                throws SdaiException
Returns the name of the user that has placed exclusive lock on remote repository. This method always returns null for local repository.

Returns:
the name of the user that has the exclusive lock or null if there is no exclusive lock on the repository
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations
Since:
4.1.0
See Also:
SdaiSession.lock(jsdai.lang.ASdaiRepository, jsdai.lang.ASchemaInstance, jsdai.lang.ASdaiModel, int)

openRepository

public abstract void openRepository()
                             throws SdaiException
Makes the SdaiModels and SchemaInstances contained in this repository available for subsequent access. If the repository is deleted or if the SdaiSession is closed, SdaiException RP_NEXS will be thrown.

Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NAVL, repository not available.
SdaiException - RP_OPN, repository open.
SdaiException - LC_NVLD, location invalid.
SdaiException - SY_ERR, underlying system error.
See Also:
"ISO 10303-22::10.4.5 Open repository"

createSdaiModel

public abstract SdaiModel createSdaiModel(java.lang.String model_name,
                                          jsdai.dictionary.ESchema_definition schema)
                                   throws SdaiException
Creates a new SdaiModel in this repository. This model is automatically added to the aggregate of type ASdaiModel, containing all models of the repository. This aggregate can be obtained by applying getModels method. The name of the new model must be unique within this repository. If the name is not supplied or is an empty string, then SdaiException VA_NSET or, respectively, VA_NVLD is thrown. The second parameter specifies some EXPRESS schema. The new model can contain instances only those entities which are defined or used in this schema. If schema is not supplied, then SdaiException SD_NDEF is thrown.

Parameters:
model_name - name of the model.
schema - underlying EXPRESS schema.
Returns:
the new created SdaiModel.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - TR_EAB, transaction ended abnormally.
SdaiException - MO_DUP, SDAI-model duplicate.
SdaiException - VA_NSET, value not set.
SdaiException - SD_NDEF, schema definition not defined.
SdaiException - RP_RO, read-only access to repository.
SdaiException - RP_LOCK, repository locked by another user.
SdaiException - SY_ERR, underlying system error.
See Also:
"ISO 10303-22::10.5.1 Create SDAI-model"

createSdaiModel

public abstract SdaiModel createSdaiModel(java.lang.String model_name,
                                          java.lang.Class schema)
                                   throws SdaiException
Creates a new SdaiModel in this repository. It is a variation of createSdaiModel(String model_name, ESchema_definition schema) method. The EXPRESS schema is specified by the second parameter whose type is Class. The value submitted to this parameter during invocation of the method shall be a special java class with the name constructed from the schema name. This class is contained in the package corresponding to the schema of interest. For example, if the schema is "geometry_schema", then the package name is "jsdai.SGeometry_schema" and the value for the second parameter shall be "jsdai.SGeometry_schema.SGeometry_schema.class".

Parameters:
model_name - name of the model.
schema - underlying EXPRESS schema.
Returns:
the new created SdaiModel.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - TR_EAB, transaction ended abnormally.
SdaiException - MO_DUP, SDAI-model duplicate.
SdaiException - VA_NSET, value not set.
SdaiException - SD_NDEF, schema definition not defined.
SdaiException - RP_RO, read-only access to repository.
SdaiException - RP_LOCK, repository locked by another user.
SdaiException - SY_ERR, underlying system error.
See Also:
"ISO 10303-22::10.5.1 Create SDAI-model"

findSdaiModel

public abstract SdaiModel findSdaiModel(java.lang.String name)
                                 throws SdaiException
Given a name, finds the SdaiModel with this name in this repository. If such a model does not exist, then null is returned.

Parameters:
name - name of the model.
Returns:
SdaiModel with the specified name.
Throws:
SdaiException - SY_ERR, underlying system error.

createSchemaInstance

public abstract SchemaInstance createSchemaInstance(java.lang.String name,
                                                    jsdai.dictionary.ESchema_definition schema)
                                             throws SdaiException
Creates a new SchemaInstance in this repository. This schema instance is automatically added to the aggregate of type ASchemaInstance, containing all schema instances of the repository. This aggregate can be obtained by applying getSchemas method. The name of the new schema instance must be unique within this repository. If name is not supplied, then SdaiException VA_NSET is thrown. The second parameter specifies some EXPRESS schema this schema instance is based on. If schema is not supplied, then SdaiException SD_NDEF is thrown.

Parameters:
name - name of the new SchemaInstance.
schema - the native schema for the SchemaInstance created.
Returns:
the new created SchemaInstance.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - TR_EAB, transaction ended abnormally.
SdaiException - SI_DUP, schema instance duplicate.
SdaiException - VA_NSET, value not set.
SdaiException - SD_NDEF, schema definition not defined.
SdaiException - RP_RO, read-only access to repository.
SdaiException - RP_LOCK, repository locked by another user.
SdaiException - SY_ERR, underlying system error.
See Also:
"ISO 10303-22::10.5.2 Create schema instance"

createSchemaInstance

public abstract SchemaInstance createSchemaInstance(java.lang.String name,
                                                    java.lang.Class schema)
                                             throws SdaiException
Creates a new SchemaInstance in this repository. It is a variation of createSchemaInstance(String name, ESchema_definition schema) method. The EXPRESS schema is specified by the second parameter whose type is Class. The value submitted to this parameter during invocation of the method shall be a special java class with the name constructed from the schema name. This class is contained in the package corresponding to the schema of interest. For example, if the schema name is "geometry_schema", then the package name is "jsdai.SGeometry_schema" and the value for the second parameter shall be "jsdai.SGeometry_schema.SGeometry_schema.class".

Parameters:
name - name of the new SchemaInstance.
schema - the native schema for the SchemaInstance created.
Returns:
the new created SchemaInstance.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - TR_EAB, transaction ended abnormally.
SdaiException - SI_DUP, schema instance duplicate.
SdaiException - VA_NSET, value not set.
SdaiException - SD_NDEF, schema definition not defined.
SdaiException - RP_RO, read-only access to repository.
SdaiException - RP_LOCK, repository locked by another user.
SdaiException - SY_ERR, underlying system error.
See Also:
"ISO 10303-22::10.5.2 Create schema instance"

findSchemaInstance

public abstract SchemaInstance findSchemaInstance(java.lang.String name)
                                           throws SdaiException
Given a name, finds the SchemaInstance with this name in this repository. If such a schema instance does not exist, then null is returned.

Parameters:
name - name of the schema instance.
Returns:
SchemaInstance with the specified name.
Throws:
SdaiException - SY_ERR, underlying system error.

closeRepository

public void closeRepository()
                     throws SdaiException
Closes this repository. In the case when a read-write transaction is active, this operation is allowed only if no model and no schema instance was created, deleted or modified since the most recent commit or abort operation was performed. If this condition is not satisfied, then SdaiException TR_RW is thrown. After closing a repository, SdaiModels and SchemaInstances contained in it become inaccessible. In turn, entity instances of any SdaiModel in this repository also become inaccessible. For most methods in class EEntity, if applied to such instances, SdaiException EI_NEXS will be thrown. The largest number appearing in the name of an instance within the repository is stored by commit in 'contents' binary file of the repository and will be extracted and used when this repository will be opened again.

Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - RP_NAVL, repository not available.
SdaiException - TR_RW, transaction read-write.
SdaiException - SY_ERR, underlying system error.
See Also:
SdaiTransaction.commit(), SdaiTransaction.abort(), "ISO 10303-22::10.5.3 Close repository"

getSessionIdentifier

public abstract EEntity getSessionIdentifier(java.lang.String label)
                                      throws SdaiException
Returns entity instance for the given persistent label. Every entity instance within a repository can be uniquely identified by its persistent label. In the role of the persistent label the entity instance name defined in "ISO 10303-21::6.3.4" is used. This method searches for the entity instance with the specified persistent label in all, even without read-only or read-write access, models of this repository. If an attempt is unsuccessful, SdaiException EI_NEXS is thrown.

Parameters:
label - the persistent label of the entity instance to look for.
Returns:
entity instance with the given persistent label.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NAVL, transaction currently not available.
SdaiException - TR_EAB, transaction ended abnormally.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - VA_NSET, value not set.
SdaiException - SY_ERR, underlying system error.
See Also:
EEntity.getPersistentLabel(), "ISO 10303-22::10.11.7 Get session identifier"

query

public int query(java.lang.String where,
                 EEntity entity,
                 AEntity result)
          throws SdaiException
This method is not implemented in current JSDAI version.

SdaiException FN_NAVL will be thrown if this method is invoked.

Specified by:
query in interface QuerySource
Parameters:
where - a String value
entity - an EEntity value
result - an AEntity value
Returns:
an int value
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.4.14 SDAI query"

getQuerySourceDomain

public ASdaiModel getQuerySourceDomain()
                                throws SdaiException
Description copied from interface: QuerySource
Returns domain in which to perform a search.

Specified by:
getQuerySourceDomain in interface QuerySource
Returns:
ASdaiModel containing the domain
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getQuerySourceInstances

public AEntity getQuerySourceInstances()
                                throws SdaiException
Description copied from interface: QuerySource
Returns starting instances which serve as the first input instance set for a query.

Specified by:
getQuerySourceInstances in interface QuerySource
Returns:
AEntity containing the instances or null this aggregate consists all instances in query source domain
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getQuerySourceInstanceRef

public jsdai.query.SerializableRef getQuerySourceInstanceRef()
                                                      throws SdaiException
Specified by:
getQuerySourceInstanceRef in interface QuerySource
Throws:
SdaiException
Since:
3.6.0

getQuerySourceDomainRef

public jsdai.query.SerializableRef getQuerySourceDomainRef()
                                                    throws SdaiException
Specified by:
getQuerySourceDomainRef in interface QuerySource
Throws:
SdaiException
Since:
3.6.0

deleteRepository

public void deleteRepository()
                      throws SdaiException
Deletes this repository. Upon termination of this method the repository does not exist both in the session (aggregate knownServers) and physically. It is not possible to get back it using linkRepository method. If the repository at the moment of invocation of this method is open, it is first closed and only then deleted. Deleting of special repository "SystemRepository", containing dictionary and mapping data, is forbidden. If the repository is degenerated, then SdaiException FN_NAVL is thrown.

This method is an extension of JSDAI, which is not a part of the standard.

Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NAVL, repository not available.
SdaiException - TR_RW, transaction read-write.
SdaiException - SY_ERR, underlying system error.
SdaiException - FN_NAVL, function not available.
See Also:
closeRepository()

exportClearTextEncoding

public void exportClearTextEncoding(java.lang.String location)
                             throws SdaiException
Creates a STEP file in a form of the exchange structure containing the data of this repository. At the moment of invocation of the method the repository must be opened. If parameter location gets some String value, then this value is used as a name for the resulting file. If, however, location is null, then the name is chosen as follows. If the repository was created during this session by applying importClearTextEncoding, then the name of the file is the same as that of the input file for importClearTextEncoding method. In the remaining cases, that is, when the repository was either created by createRepository or linked by linkRepository, the name of the resulting file coincides with the name of the repository. The contents of each model of the repository is written down to the file as a separate data section. The header of the file includes time-stamp which specifies the date and time when this repository was created or most recently modified. The value of the attribute implementation_level of the entity file_description in the header of the exchange structure (see ISO 10303-21::8.2.1 file_description) can take one of the following values: During creation of an instance of file_population for a schema instance only those models in the set associated_models which belong to this repository are listed. Models from the other repositories simply are ignored. However, if all models of this repository belong to associated_models of the schema instance considered, then the value standing for associated_models in the corresponding instance of file_population is missing, that is, dollar sign is used (see ISO 10303-21::8.2.4 file_population).

The repository may contain instances which reference instances in other repositories. In this case the strategy is as follows:

After execution of this method the repository itself remains unchanged. In particular, all references (if any) from the current repository to other repositories are retained. The method is disabled for special repository "SystemRepository", containing dictionary and mapping data. In this case SdaiException FN_NAVL is thrown.

Parameters:
location - the name of the file created by the method.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NAVL, transaction currently not available.
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
See Also:
exportClearTextEncoding(String location, String file_name), see "ISO 10303-21"

exportClearTextEncoding

public void exportClearTextEncoding(java.lang.String location,
                                    java.lang.String file_name)
                             throws SdaiException
Creates a STEP file in a form of the exchange structure containing the data of this repository. At the moment of invocation of the method the repository must be opened. If parameter location gets some String value, then this value is used as a name for the resulting file. If, however, location is null, then the name is chosen as follows. If the repository was created during this session by applying importClearTextEncoding, then the name of the file is the same as that of the input file for importClearTextEncoding method. In the remaining cases, that is, when the repository was either created by createRepository or linked by linkRepository, the name of the resulting file coincides with the name of the repository. The second parameter of the method can be used to set the value of the attribute name of the header entity file_name (see ISO 10303-21::8.2.2 file_name). If this parameter is null, then the value of name depends on the origin of the repository. If it has been imported from an exchange structure, then the existing value of name is taken. If, however, the repository was created, then its name as the value of the attribute name is used.

The contents of each model of the repository is written down to the file as a separate data section. The header of the file includes time-stamp which specifies the date and time when this repository was created or most recently modified. The value of the attribute implementation_level of the entity file_description in the header of the exchange structure (see ISO 10303-21::8.2.1 file_description) can take one of the following values:

During creation of an instance of file_population for a schema instance only those models in the set associated_models which belong to this repository are listed. Models from the other repositories simply are ignored. However, if all models of this repository belong to associated_models of the schema instance considered, then the value standing for associated_models in the corresponding instance of file_population is missing, that is, dollar sign is used (see ISO 10303-21::8.2.4 file_population).

The repository may contain instances which reference instances in other repositories. In this case the strategy is as follows:

Applying this method, it is possible to write entity names either in usual form or in short form. For example, for entity cartesian_point any of the following cases can be chosen:

To change the current alternative, shortNameSupport method should be used. Selecting the short form can give the desired result only if the short names of entities are defined in the data dictionary (provided by an Express compiler). If, for an entity, the method fails to identify its short name, then the full entity name is used instead of.

After execution of this method the repository itself remains unchanged. In particular, all references (if any) from the current repository to other repositories are retained. The method is disabled for special repository "SystemRepository", containing dictionary and mapping data. In this case SdaiException FN_NAVL is thrown.

Parameters:
location - the name of the file created by the method.
file_name - the name of the exchange structure to which this repository is exported.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NAVL, transaction currently not available.
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
See Also:
exportClearTextEncoding(String location), SchemaInstance.exportClearTextEncoding(java.lang.String), "ISO 10303-21"

exportClearTextEncoding

public void exportClearTextEncoding(java.io.OutputStream location)
                             throws SdaiException
Creates a STEP file in a form of the exchange structure containing the data of this repository. At the moment of invocation of the method the repository must be opened. The exchange structure is written to the supplied stream. For more details about the exchange format see exportClearTextEncoding(String location, String file_name). Invoking this method is equivalent to making this call: exportClearTextEncoding(location, null);

Parameters:
location - an OutputStream value
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

exportClearTextEncoding

public void exportClearTextEncoding(java.io.OutputStream location,
                                    java.lang.String file_name)
                             throws SdaiException
Creates a STEP file in a form of the exchange structure containing the data of this repository. At the moment of invocation of the method the repository must be opened. The exchange structure is written to the supplied stream. For more details about the exchange format see exportClearTextEncoding(String location, String file_name)

Parameters:
location - an OutputStream value
file_name - the name of the exchange structure to which this repository is exported. It sets the value of the attribute name of the header entity file_name (see ISO 10303-21::8.2.2 file_name). If this parameter is null, then the value of name depends on the origin of the repository. If it has been imported from an exchange structure, then the existing value of name is taken. If, however, the repository was created, then its name as the value of the attribute name is used.
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

exportXml

public void exportXml(java.io.OutputStream location,
                      InstanceReader instanceReader)
               throws SdaiException
Writes this repository in XML representation to specified stream. Output format is controlled by instanceReader parameter.

Parameters:
location - an OutputStream to write XML to
instanceReader - an InstanceReader describing output format
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations
See Also:
jsdai.xml.InstanceReader, jsdai.xml.LateBindingReader

importXml

public void importXml(java.io.InputStream location)
               throws SdaiException
Reads repository from specified stream as XML representation.

Parameters:
location - an InputStream to read XML from.
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations
See Also:
InstanceWriterSelector

isActive

public boolean isActive()
                 throws SdaiException
Informs if this repository is open. An exception will be thrown if the repository is deleted or if the SdaiSession is closed.

Returns:
true if this repository is open, and false otherwise.
Throws:
SdaiException - RP_NEXS, repository does not exist.

isModified

public boolean isModified()
                   throws SdaiException
Informs if this repository is modified. A repository is called modified if either at least one model or schema instance has been created, deleted or modified or some data outside repository contents were modified since the most recent commit or abort operation was performed. The method is available only if the repository is open.

Returns:
true if this repository is modified, and false otherwise.
Throws:
SdaiException - RP_NEXS, repository does not exist.
SdaiException - RP_NOPN, repository is not open.

toString

public java.lang.String toString()
Returns a description of this repository as a String. It includes constant string "SdaiRepository: " and repository name.

Returns:
a description of the repository.

addSdaiListener

public void addSdaiListener(SdaiListener listener)
Adds SdaiListener extending java.util.EventListener to a special aggregate in this repository.

Specified by:
addSdaiListener in interface SdaiEventSource
Parameters:
listener - a SdaiListener to be added.
See Also:
removeSdaiListener(jsdai.lang.SdaiListener)

removeSdaiListener

public void removeSdaiListener(SdaiListener listener)
Removes SdaiListener extending java.util.EventListener from the special aggregate in this repository.

Specified by:
removeSdaiListener in interface SdaiEventSource
Parameters:
listener - SdaiListener to be removed.
See Also:
addSdaiListener(jsdai.lang.SdaiListener)

getPersistentLabel

public long getPersistentLabel()
Returns current persistent label.

Returns:
persistent label.
See Also:
setNextPersistentLabel(long)

setNextPersistentLabel

public abstract void setNextPersistentLabel(long newPersistentLabel)
                                     throws SdaiException
Assigns a long value to the next persistent label, which will be used for the next instance. Value of the next persistent label must be unused.

Parameters:
newPersistentLabel - long value of next persistent label.
Throws:
SdaiException - VA_NVLD, value invalid.
See Also:
getPersistentLabel()

getSdaiModelByRef

public SdaiModel getSdaiModelByRef(jsdai.query.SerializableRef modelRef)
                            throws SdaiException
Returns remote SdaiModel using specified model reference.

Parameters:
modelRef - SerializableRef used to refer to remote model.
Returns:
SdaiModel refered by specified model reference.
Throws:
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
See Also:
getSchemaInstanceByRef(SerializableRef), getInstanceByRef(SerializableRef)

getSchemaInstanceByRef

public SchemaInstance getSchemaInstanceByRef(jsdai.query.SerializableRef schemaRef)
                                      throws SdaiException
Returns remote SchemaInstance using specified schema instance reference.

Parameters:
schemaRef - SerializableRef used to refer to remote schema instance.
Returns:
SchemaInstance refered by specified schema instance reference.
Throws:
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
See Also:
getSdaiModelByRef(SerializableRef), getInstanceByRef(SerializableRef)

getInstanceByRef

public EEntity getInstanceByRef(jsdai.query.SerializableRef entityRef)
                         throws SdaiException
Returns remote EEntity using specified entity reference.

Parameters:
entityRef - SerializableRef used to refer to remote entity instance.
Returns:
EEntity refered by specified entity instance reference.
Throws:
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
See Also:
getSdaiModelByRef(SerializableRef), getSchemaInstanceByRef(SerializableRef)

getRealName

public java.lang.String getRealName()
                             throws SdaiException
Returns the real (without recurrence number) name of the repository as a String.

The repositories known to an SdaiSession must have unique names. An exception will be thrown if the repository is deleted or if the SdaiSession is closed.

Returns:
the real name of this repository.
Throws:
SdaiException - RP_NEXS, repository does not exist.
Since:
3.6.0

copyFrom

public void copyFrom(SdaiRepository sourceRepository)
              throws SdaiException
Makes a copy of all models together with instances and schema instances from the specified repository to this repository. References between instances of the given repository are mapped to references between their copies. Other values for attributes of the newly created copies are taken from the original instances similarly as in copyInstances method.

This method is an extension of JSDAI, which is not a part of the standard.

Parameters:
sourceRepository - the source repository.
Throws:
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - MO_NEXS, SDAI-model does not exist.
SdaiException - MX_NRW, SDAI-model access not read-write.
SdaiException - ED_NVLD, entity definition invalid.
SdaiException - VA_NSET, value not set.
SdaiException - VA_NVLD, value invalid.
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
Since:
3.6.0
See Also:
copyFrom(SchemaInstance), copyFrom(ASchemaInstance)

copyFrom

public void copyFrom(SchemaInstance sourceSchemaInstance)
              throws SdaiException
Makes a copy of all instances from the specified schema instance to this repository. References between instances of the given repository are mapped to references between their copies. Other values for attributes of the newly created copies are taken from the original instances similarly as in copyInstances method.

This method is an extension of JSDAI, which is not a part of the standard.

Parameters:
sourceSchemaInstance - the source repository.
Throws:
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - MO_NEXS, SDAI-model does not exist.
SdaiException - MX_NRW, SDAI-model access not read-write.
SdaiException - ED_NVLD, entity definition invalid.
SdaiException - VA_NSET, value not set.
SdaiException - VA_NVLD, value invalid.
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
Since:
3.6.0
See Also:
copyFrom(SdaiRepository), copyFrom(ASchemaInstance)

copyFrom

public void copyFrom(ASchemaInstance aSourceSchemaInstance)
              throws SdaiException
Makes a copy of all instances from the specified schema instance aggregate to this repository. References between instances of the given repository are mapped to references between their copies. Other values for attributes of the newly created copies are taken from the original instances similarly as in copyInstances method.

This method is an extension of JSDAI, which is not a part of the standard.

Parameters:
aSourceSchemaInstance - the source repository.
Throws:
SdaiException - TR_NEXS, transaction does not exist.
SdaiException - TR_NRW, transaction not read-write.
SdaiException - MO_NEXS, SDAI-model does not exist.
SdaiException - MX_NRW, SDAI-model access not read-write.
SdaiException - ED_NVLD, entity definition invalid.
SdaiException - VA_NSET, value not set.
SdaiException - VA_NVLD, value invalid.
SdaiException - FN_NAVL, function not available.
SdaiException - SY_ERR, underlying system error.
Since:
3.6.0
See Also:
copyFrom(SdaiRepository), copyFrom(SchemaInstance)

setLocation

public void setLocation(java.lang.String location)
                 throws SdaiException
Assigns a String value to the location attribute of the repository. This assignment is allowed only if the repository is stored in SDAI file else SdaiException FN_NAVL is thrown. If the new location has been assigned successfully, then new SDAI file will be created for the current repository while performing commit operation. Old SDAI file will remain untouched in the old location after commit operation.

This method is an extension of JSDAI, which is not a part of the standard.

Parameters:
location - the new location of the repository.
Throws:
SdaiException - FN_NAVL, function not available.
Since:
4.0.0
See Also:
getLocation()

Copyright © LKSoftWare GmbH, 1999-2008