站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

MDRepository (NetBeans MDR API) - NetBeans API Javadoc 5.0.0

 

org.netbeans.api.mdr
Interface MDRepository

All Superinterfaces:
MDRChangeSource

public interface MDRepository
extends MDRChangeSource

Interface for accessing content of a metadata repository.


Method Summary
 void beginTrans(boolean writeAccess)
          Starts a new transaction.
 javax.jmi.reflect.RefPackage createExtent(String substName)
          Instantiates MOF Model package.
 javax.jmi.reflect.RefPackage createExtent(String substName, javax.jmi.reflect.RefObject metaPackage)
          Instantiates given package.
 javax.jmi.reflect.RefPackage createExtent(String substName, javax.jmi.reflect.RefObject metaPackage, javax.jmi.reflect.RefPackage[] existingInstances)
          Instantiates given package.
 void endTrans()
          Ends transaction started by beginTrans call.
 void endTrans(boolean rollback)
          Ends transaction started by beginTrans call.
 javax.jmi.reflect.RefBaseObject getByMofId(String mofId)
          Returns the object with the given MOF ID.
 javax.jmi.reflect.RefPackage getExtent(String name)
          Returns reference to a package extent of a given name.
 String[] getExtentNames()
          Returns names for all named package extents in the repository.
 void shutdown()
          Shuts down the repository.
 
Methods inherited from interface org.netbeans.api.mdr.events.MDRChangeSource
addListener, addListener, removeListener, removeListener
 

Method Detail

createExtent

public javax.jmi.reflect.RefPackage createExtent(String substName)
                                          throws CreationFailedException
Instantiates MOF Model package.

Parameters:
substName - name (unique within the repository) for the new MOF package extent
Returns:
reference to the created package extent
Throws:
CreationFailedException - instantiation of the package failed (e.g. if an extent with a given name already exists)

createExtent

public javax.jmi.reflect.RefPackage createExtent(String substName,
                                                 javax.jmi.reflect.RefObject metaPackage)
                                          throws CreationFailedException
Instantiates given package. If the package that has to be instantiated clusters some other packages, these clustered packages will be instantiated automatically but they will be not associated with any names so they will not be accessible directly. If the instantiated package will be deleted, the automatically created extents will also be deleted (if there are no other references to them).

Parameters:
substName - name (unique within the repository) for the new package extent
metaPackage - reference to the package that should be instantiated
Returns:
reference to the created extent
Throws:
CreationFailedException - instantiation of the package failed (e.g. if an extent with a given name already exists)

createExtent

public javax.jmi.reflect.RefPackage createExtent(String substName,
                                                 javax.jmi.reflect.RefObject metaPackage,
                                                 javax.jmi.reflect.RefPackage[] existingInstances)
                                          throws CreationFailedException
Instantiates given package. If the package that is to be instantiated clusters some other packages, repository will use a corresponding existing package extent passed in existingExtents parameter for clustering. If an instance of some particular package cannot be found in existingExtents paramter, it will be automatically created (this instance will not have any name and thus it won't be accessible directly; once none of existing extents will cluster it, it should be deleted automatically).

Parameters:
substName - name (unique within the repository) for the new package extent
metaPackage - reference to the package that should be instantiated
existingInstances - existing package extents that will be used instead of creating a new extent if a package is clustered
Returns:
reference to the created extent
Throws:
CreationFailedException - instantiation of the package failed (e.g. if an extent with a given name already exists)

getExtent

public javax.jmi.reflect.RefPackage getExtent(String name)
Returns reference to a package extent of a given name.

Parameters:
name - name of the package extent to be returned
Returns:
reference to the package extent (returns null if extent of a given name was not found)

getExtentNames

public String[] getExtentNames()
Returns names for all named package extents in the repository.

Returns:
Array of extent names.

getByMofId

public javax.jmi.reflect.RefBaseObject getByMofId(String mofId)
Returns the object with the given MOF ID.

Parameters:
mofId - the MOF ID of the object to be returned
Returns:
the object with the given MOF ID or null if no such object is found

beginTrans

public void beginTrans(boolean writeAccess)
Starts a new transaction. This method causes that the repository will be locked for read-only access or exclusive write access (depending on the value passed as a parameter) and starts a new transaction. It is prefered to enclose any batch operations on MDR by beginTrans and endTrans calls to avoid autocommiting (which may be slow) after each JMI operation.

Transactions can be nested however real nested transaction commit/rollback does not need to be implemented - implementation can commit/rollback whole transaction after the outermost endTrans call depending on whether any nested transaction failed.

During each transaction it is guaranteed that no other thread can modify the metadata.

Important:This call locks the repository and the lock is held till the transaction is ended by a call to endTrans. To make sure there is a corresponding endTrans call to each beginTrans call use the try-finally construct:

beginTrans(false);
try {
    // set of JMI calls
} finally {
    endTrans();
}

Parameters:
writeAccess - true indicates that the transaction will be modifying the repository. false means the transaction is read-only (it will not be allowed to modify any data). Transactions with write access cannot be nested into read-only transactions.

endTrans

public void endTrans()
Ends transaction started by beginTrans call. If the transaction modified some data, this call will attemp to commit it.

This method has the same effect as calling endTrans(false).


endTrans

public void endTrans(boolean rollback)
Ends transaction started by beginTrans call. Result of this call depends on whether it is nested in another beginTrans - endTrans pair or not. If this call is nested and value of rollback parameter is false, it will not affect the result of the endTrans call corresponding to the outermost call to beginTrans. However if true is passed, the whole transaction will be rolled back by the last (i.e. outermost) endTrans call (no matter what will be the value of rollback parameter for this last call). If this call is not nested (i.e. it is outermost) the whole transaction is commited if false was passed to this call and all the nested endTrans calls. Otherwise (if true was passed to this call or any nested endTrans call) the transaction is rolled back.


shutdown

public void shutdown()
Shuts down the repository. This method should be called from MDRManager.shutdownAll() method. Implementation of this method should do all the necessary clean-up actions, such as flushing storage caches, etc.


 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.