Package es.bsc.dataclay.commonruntime
Class ClientManagementLib
- java.lang.Object
-
- es.bsc.dataclay.commonruntime.ClientManagementLib
-
public final class ClientManagementLib extends Object
This class contains all those functions that the User needs to interact with the system to register users, classes, namespaces...
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIGFILEPATH_ENV
Environment variable where configuration file can be specified.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
activateTracing(boolean initializeWrapper)
Activate tracingstatic void
activateTracingInDataClayServices()
Activate tracing in dataClay servicesstatic void
closeSession()
Finish sessionstatic void
deactivateTracing(boolean finalizeWrapper)
Deactivate tracingstatic void
deactivateTracingInDataClayServices()
Dectivate tracingstatic void
finishConnections()
Finish connections to serverstatic Map<String,MetaClass>
generateSpecs(String namespace, String classPath, Set<String> classNames)
Generate Specifications of classesstatic Set<String>
getAccountDatasets(AccountID accountID, PasswordCredential credential)
Get datasets provided by the given accountstatic AccountID
getAccountID(String userName)
Method that retrieves the id of an account given its user namestatic Set<String>
getAndStoreStubs(AccountID applicantAccountID, PasswordCredential applicantCredential, LinkedList<ContractID> contractsIDs, String targetDirectoryPath)
Method that allows to retrieve the stubs and prototypes of the given contract and store them to certain directorystatic boolean
getAndStoreStubsForEnrichment(AccountID applicantAccountID, PasswordCredential applicantCredential, LinkedList<ContractID> contractsIDs, String targetDirectoryPath)
Method that allows to retrieve the stubs FOR ENRICHMENT of the given contract and store them to certain directorystatic Set<String>
getBackendNames(AccountID accountID, PasswordCredential credential, CommonMessages.Langs backendLanguage)
Method that retrieves the info of the registered backends assuming that they might have 1 storage location and/or 1 exec environmentstatic Map<MetaClassID,MetaClass>
getClassesInfoInNamespace(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID)
Method that retrieves the info of the classes registered in a specific namespace.static MetaClassID
getClassID(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className)
Method that retrieves the id of a class given its namestatic MetaClass
getClassInfo(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className)
Method that retrieves the info of a class given its name.static ContractID
getContractOfDataClayProvider(AccountID accountID, PasswordCredential credential)
Return all contracts info of public DataClay provider.static Map<ContractID,Contract>
getContractsOfApplicant(AccountID accountID, PasswordCredential credential)
Return the info of all the contracts of the user (as applicant) specified.static Map<ContractID,Contract>
getContractsOfApplicant(AccountID accountID, PasswordCredential credential, NamespaceID namespaceIDofProvider)
Return the info of all the contracts of the user (as applicant) specified with the namespace provider specified.static Map<ContractID,Contract>
getContractsOfProvider(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID)
Return all contracts info of the namespace provider.static ClientRuntime
getDataClayClientLib()
Get the common librarystatic DataClayInstanceID
getDataClayID()
Method that retrieves the current dataClay identifierstatic DataContract
getDataContractInfoOfApplicantWithProvider(AccountID accountID, PasswordCredential credential, DataSetID datasetIDofProvider)
Return the info of all the data contracts of the user (as applicant) specified with the dataset provider specified.static Map<DataContractID,DataContract>
getDataContractsOfApplicant(AccountID accountID, PasswordCredential credential)
Return the info of all the data contracts of the user (as applicant) specified.static Map<DataContractID,DataContract>
getDataContractsOfProvider(AccountID accountID, PasswordCredential credential, DataSetID datasetID)
Return all contracts info of the dataset provider.static DataSetID
getDatasetID(AccountID accountID, PasswordCredential credential, String datasetName)
Retrieves the id of a dataset identified by name providedstatic Map<ExecutionEnvironmentID,ExecutionEnvironment>
getExecutionEnvironmentsInfo(CommonMessages.Langs language, boolean forceUpdateCache)
Method that retrieves the info of the execution environments of a specific languagestatic DataClayInstanceID
getExternalDataClayID(String dcHost, int dcPort)
Tries to connect to an external dataClay instance and retrieve its ID.static Interface
getInterfaceInfo(AccountID accountID, PasswordCredential credential, InterfaceID interfaceID)
Method that retrieves the info of the interface if the account is registered in a contract that contains itstatic String
getManifestInfo()
Get Manifest versionstatic NamespaceID
getNamespaceID(AccountID accountID, PasswordCredential credential, String namespaceName)
Retrieves the id of a namespace identified by name providedstatic CommonMessages.Langs
getNamespaceLanguage(AccountID accountID, PasswordCredential credential, String namespaceName)
Retrieves the id of a namespace identified by name providedstatic Set<String>
getNamespaces(AccountID accountID, PasswordCredential credential)
Retrieves available namespaces from the account provided.static Set<AccountID>
getNonAdminAccountList(AccountID adminAccountID, PasswordCredential adminCredential)
Method that retrieves the list of non admin accounts registered in the system.static OperationID
getOperationID(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className, String operationSignature)
Method that retrieves the id of an operation given its signaturestatic PropertyID
getPropertyID(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className, String propertyName)
Method that retrieves the id of a property given its signaturestatic Set<String>
getPublicDatasets(AccountID accountID, PasswordCredential credential)
Get all public datasets (which the account can be registered to)static Map<String,byte[]>
getStubs(AccountID applicantAccountID, PasswordCredential applicantCredential, LinkedList<ContractID> contractsIDs)
Method that allows to retrieve the stubsstatic void
getTracesInDataClayServices()
Get traces in dataClay services and store it in current workspacestatic boolean
importContract(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, ContractID contractID)
Imports all the classes represented by the interfaces of the given contract into a specific namespacestatic boolean
importInterface(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, ContractID contractID, InterfaceID interfaceID)
Imports a class from a specific interface in a specific contract into the given namespacestatic void
importModelsFromExternalDataClay(String externalNamespace, DataClayInstanceID extDataClayID)
Import classes in namespace specified from an external dataClaystatic boolean
initializeCMLib(String configFilePathArg)
Initialize connections with LM.static AccountID
newAccount(Account newAcc)
This operation creates a new account in the system with the provided username.static Map<String,MetaClass>
newClass(AccountID accountID, PasswordCredential credentials, String namespace, String className, String classPath, String srcPath, String libPath)
This operation creates a new metaclass in the system of the provided className from the given classPath and associate it to the Namespace provided.static Map<String,MetaClass>
newClasses(AccountID accountID, PasswordCredential credentials, String namespace, Set<String> classNames, String classPath, String srcPath, String libPath)
This operation creates a new metaclass in the system for each class with name provided from the given classPath and associate it to the Namespace provided.static Map<String,MetaClass>
newClassInternal(AccountID accountID, PasswordCredential credentials, Map<String,MetaClass> newClasses, String classPath, String srcPath, String libPath)
Internal function for newClassstatic DataSetID
newDataSet(AccountID accountID, PasswordCredential credential, DataSet dataSet)
Method that creates a new namespace in the system.static InterfaceID
newInterface(AccountID accountID, PasswordCredential credential, Interface interfaceSpec)
Method that registers a new interfacestatic NamespaceID
newNamespace(AccountID accountID, PasswordCredential credential, Namespace newNamespace)
Method that creates a new namespace in the system.static ContractID
newPrivateContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, Contract contract)
Method to register a new private contract.static DataContractID
newPrivateDataContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, DataContract datacontract)
Method to register a new private data contract.static ContractID
newPublicContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, Contract contract)
Method that registers a new contractstatic DataContractID
newPublicDataContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, DataContract datacontract)
Method that registers a new public data contractstatic SessionID
newSession(AccountID accountID, PasswordCredential credential, String classPathOfStubs, Set<String> dataSets, String dataSetForStore)
This operation creates a new sessionstatic SessionID
newSession(AccountID accountID, PasswordCredential credential, Map<String,StubInfo> stubsInfo, Set<String> dataSets, String dataSetForStore)
This operation creates a new sessionstatic SessionID
newSession(AccountID accountID, PasswordCredential credential, Set<ContractID> contracts, Set<String> dataSets, String dataSetForStore)
This operation creates a new sessionstatic byte[]
performSetOfNewAccounts(AccountID adminID, PasswordCredential credential, byte[] yamlRequest)
Call that performs a series of account creations, described by one YAML file.static byte[]
performSetOfOperations(AccountID performerID, PasswordCredential credential, byte[] yamlRequest)
Call that performs a series of operations (user type), described by one YAML file.static void
publishAddress(String hostname, int port)
Configure LogicModule to give provided address in case external dataClays require to know how to access current dataClaystatic void
registerEventListenerImpl(AccountID accountID, PasswordCredential credentials, ECA eventListenerImpl)
Register Event listener implementation i.e.static DataClayInstanceID
registerExternalDataClay(String dcHost, int dcPort)
Method that registers the info of a dataClay instancestatic DataClayInstanceID
registerExternalDataClayOverrideAuthority(AccountID adminAccountID, PasswordCredential adminCredential, String dcHost, int dcPort, String authority)
ADMIN usage only.static boolean
registerToPublicContract(AccountID accountID, PasswordCredential credential, ContractID contractID)
Method to register an account to a contractstatic ContractID
registerToPublicContractOfNamespace(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID)
Method to register an account to a contractstatic boolean
registerToPublicDataContract(AccountID accountID, PasswordCredential credential, DataContractID datacontractID)
Method to register an account to a data contractstatic boolean
removeClass(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className)
Method that removes a class from the specified namespace (either removing the imports or because it was actually created in the namespace)static boolean
removeDataset(AccountID accountID, PasswordCredential credential, String datasetName)
This method removes a dataset from the system by checking it has no active data contract associated with it, and no objects registered in it.static boolean
removeImplementation(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, ImplementationID implementationID)
Method that removes an implementation of a certain operationstatic boolean
removeInterface(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, InterfaceID interfaceID)
Method that removes a specific interfacestatic boolean
removeNamespace(AccountID accountID, PasswordCredential credential, String namespaceName)
This method removes a namespace from the system by checking it has no active contract associated with it, and no classes registered on it.static boolean
removeOperation(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className, String operationSignature)
Method that removes an operation from the specified namespacestatic void
updateExternalDataClay(DataClayInstanceID dcID, String dcHost, int dcPort)
Method that updates the info of a dataClay instance (adds new "access")static void
waitForAsyncRequestToFinish()
Wait for asynchronous requests to finish.
-
-
-
Field Detail
-
CONFIGFILEPATH_ENV
public static final String CONFIGFILEPATH_ENV
Environment variable where configuration file can be specified.- See Also:
- Constant Field Values
-
-
Method Detail
-
getManifestInfo
public static String getManifestInfo()
Get Manifest version- Returns:
- Version of the library
-
initializeCMLib
public static boolean initializeCMLib(String configFilePathArg)
Initialize connections with LM.- Parameters:
configFilePathArg
- optional path of config file. If a null or empty string is provided, the method will try looking for it in the path defined by dataClayCLIENTCONFIG environment variable, or the default path CONFIGFILEPATH- Returns:
- TRUE if connections were successfully initiliazed. FALSE, otherwise.
-
finishConnections
public static void finishConnections() throws Exception
Finish connections to server- Throws:
Exception
- if some exception occurs
-
getDataClayClientLib
public static ClientRuntime getDataClayClientLib()
Get the common library- Returns:
- The common lib
-
newAccount
public static AccountID newAccount(Account newAcc)
This operation creates a new account in the system with the provided username.- Parameters:
newAcc
- Specifications of account to create- Returns:
- AccountID of the new account if the it was successfully created. Null otherwise.
-
getAccountID
public static AccountID getAccountID(String userName)
Method that retrieves the id of an account given its user name- Parameters:
userName
- Name of the user- Returns:
- the id of Account class if the operation succeeds. null otherwise
- Throws:
RemoteException
- if some exception occurs
-
getNonAdminAccountList
public static Set<AccountID> getNonAdminAccountList(AccountID adminAccountID, PasswordCredential adminCredential)
Method that retrieves the list of non admin accounts registered in the system.- Parameters:
adminAccountID
- ID of the account of the user that calls the operationadminCredential
- Credential of the adminAccount provided- Returns:
- IDs of existent accounts (admin not included)
-
newSession
public static SessionID newSession(AccountID accountID, PasswordCredential credential, Map<String,StubInfo> stubsInfo, Set<String> dataSets, String dataSetForStore)
This operation creates a new session- Parameters:
accountID
- ID of the account that generates the sessioncredential
- credentials of the accountstubsInfo
- Stubs info to use in new SessiondataSets
- Accessible datasets for the session (user must have one data contract for each dataset)dataSetForStore
- Dataset for store (dataset must be include among the dataSets)- Returns:
- the Session ID of the new session
-
newSession
public static SessionID newSession(AccountID accountID, PasswordCredential credential, String classPathOfStubs, Set<String> dataSets, String dataSetForStore)
This operation creates a new session- Parameters:
accountID
- ID of the account that generates the sessioncredential
- credentials of the accountclassPathOfStubs
- class path where stubs (interfaces in contracts) can be founddataSets
- Accessible datasets for the session (user must have one data contract for each dataset)dataSetForStore
- Dataset for store (dataset must be include among the dataSets)- Returns:
- the Session ID of the new session
-
newSession
public static SessionID newSession(AccountID accountID, PasswordCredential credential, Set<ContractID> contracts, Set<String> dataSets, String dataSetForStore)
This operation creates a new session- Parameters:
accountID
- ID of the account that generates the sessioncredential
- credentials of the accountcontracts
- All contracts to be used in the new session to be createddataSets
- Accessible datasets for the session (user must have one data contract for each dataset)dataSetForStore
- Dataset for store (dataset must be include among the dataSets)- Returns:
- the Session ID of the new session
-
closeSession
public static void closeSession()
Finish session
-
publishAddress
public static void publishAddress(String hostname, int port)
Configure LogicModule to give provided address in case external dataClays require to know how to access current dataClay- Parameters:
hostname
- Hostname to be published (given to external dataClays)port
- Port to be published
-
newNamespace
public static NamespaceID newNamespace(AccountID accountID, PasswordCredential credential, Namespace newNamespace)
Method that creates a new namespace in the system. The account doing the action must have admin role.- Parameters:
accountID
- the account id of the account or the responsible of the namespacecredential
- the credential of the account or the responsible of the namespacenewNamespace
- the new namespace- Returns:
- the id of the new namespace if the operation succeeds. null otherwise
-
removeNamespace
public static boolean removeNamespace(AccountID accountID, PasswordCredential credential, String namespaceName)
This method removes a namespace from the system by checking it has no active contract associated with it, and no classes registered on it.- Parameters:
accountID
- the account id of the responsible of the namespacecredential
- credentials of the accountnamespaceName
- the name of the namespace to be removed- Returns:
- True if the namespace is the namespace is correctly removed. False otherwise.
-
getNamespaceID
public static NamespaceID getNamespaceID(AccountID accountID, PasswordCredential credential, String namespaceName)
Retrieves the id of a namespace identified by name provided- Parameters:
accountID
- ID of an account asking for the IDcredential
- credential of accountnamespaceName
- Name of the namespace- Returns:
- ID of the namespace or NULL if an error happened.
- Throws:
RemoteException
- If some exception occurs
-
getNamespaceLanguage
public static CommonMessages.Langs getNamespaceLanguage(AccountID accountID, PasswordCredential credential, String namespaceName)
Retrieves the id of a namespace identified by name provided- Parameters:
accountID
- ID of an account asking for the languagecredential
- credential of accountnamespaceName
- Name of the namespace- Returns:
- ID of the namespace or NULL if an error happened.
- Throws:
RemoteException
- If some exception occurs
-
getNamespaces
public static Set<String> getNamespaces(AccountID accountID, PasswordCredential credential)
Retrieves available namespaces from the account provided.- Parameters:
accountID
- ID of the account retreiving the information.credential
- Credentials of the account.- Returns:
- set of namespaces names available from the account provided.
-
importInterface
public static boolean importInterface(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, ContractID contractID, InterfaceID interfaceID)
Imports a class from a specific interface in a specific contract into the given namespace- Parameters:
accountID
- ID of the accountcredential
- credential of the accountnamespaceID
- ID of the namespace where the class will be importedcontractID
- ID of the contractinterfaceID
- ID of the interface- Returns:
- TRUE if the interface has been successuflly imported, FALSE otherwise
-
importContract
public static boolean importContract(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, ContractID contractID)
Imports all the classes represented by the interfaces of the given contract into a specific namespace- Parameters:
accountID
- ID of the accountcredential
- credential of the accountnamespaceID
- ID of the namespace where classes will be importedcontractID
- ID of the contract- Returns:
- TRUE if the interface has been successuflly imported, FALSE otherwise
-
newDataSet
public static DataSetID newDataSet(AccountID accountID, PasswordCredential credential, DataSet dataSet)
Method that creates a new namespace in the system. The account doing the action must have admin role.- Parameters:
accountID
- the account id of the account or the responsible of the namespacecredential
- the credential of the account or the responsible of the namespacedataSet
- the new dataset- Returns:
- the id of the new namespace if the operation succeeds. null otherwise
-
removeDataset
public static boolean removeDataset(AccountID accountID, PasswordCredential credential, String datasetName)
This method removes a dataset from the system by checking it has no active data contract associated with it, and no objects registered in it.- Parameters:
accountID
- the account id of the responsible of the dataset (or admin)credential
- credentials of the accountdatasetName
- the name of the dataset to be removed- Returns:
- True if the dataset is correctly removed. False otherwise.
-
getDatasetID
public static DataSetID getDatasetID(AccountID accountID, PasswordCredential credential, String datasetName)
Retrieves the id of a dataset identified by name provided- Parameters:
accountID
- ID of an account asking for the IDcredential
- credential of accountdatasetName
- Name of the dataset- Returns:
- ID of the dataset or NULL if an error happened.
-
getPublicDatasets
public static Set<String> getPublicDatasets(AccountID accountID, PasswordCredential credential)
Get all public datasets (which the account can be registered to)- Parameters:
accountID
- id of the account performing requestcredential
- credential of account performing request- Returns:
- Set of names of public datasets
-
getAccountDatasets
public static Set<String> getAccountDatasets(AccountID accountID, PasswordCredential credential)
Get datasets provided by the given account- Parameters:
accountID
- id of the accountcredential
- credential of the account- Returns:
- Set of names of account's datasets.
-
newClass
public static Map<String,MetaClass> newClass(AccountID accountID, PasswordCredential credentials, String namespace, String className, String classPath, String srcPath, String libPath)
This operation creates a new metaclass in the system of the provided className from the given classPath and associate it to the Namespace provided.- Parameters:
accountID
- ID of the account of the user that calls the operationcredentials
- Credentials of the account providednamespace
- Namespace in which to create the metaclassclassName
- name of the class (packages included if necessary)classPath
- class path of the classsrcPath
- path to the source files of the classeslibPath
- path to the libraries of the application (including dataclayClient)- Returns:
- the information of all registered classes if the operation succeeds. null otherwise.
-
newClasses
public static Map<String,MetaClass> newClasses(AccountID accountID, PasswordCredential credentials, String namespace, Set<String> classNames, String classPath, String srcPath, String libPath)
This operation creates a new metaclass in the system for each class with name provided from the given classPath and associate it to the Namespace provided.- Parameters:
accountID
- ID of the account of the user that calls the operationcredentials
- Credentials of the account providednamespace
- Namespace in which to create the metaclassclassNames
- name of classes (packages included if necessary)classPath
- class path of the classessrcPath
- path to the source files of the classeslibPath
- path to the libraries of the application (including dataclayClient)- Returns:
- the information of all registered classes if the operation succeeds. null otherwise.
-
generateSpecs
public static Map<String,MetaClass> generateSpecs(String namespace, String classPath, Set<String> classNames)
Generate Specifications of classes- Parameters:
namespace
- Namespace of class to registerclassPath
- Path in where classes are locatedclassNames
- Names of classes to analyze- Returns:
- Specifications of classes
-
newClassInternal
public static Map<String,MetaClass> newClassInternal(AccountID accountID, PasswordCredential credentials, Map<String,MetaClass> newClasses, String classPath, String srcPath, String libPath)
Internal function for newClass- Parameters:
accountID
- ID of registratorcredentials
- CredentialsnewClasses
- Specifications of classes to registerclassPath
- Class path of new classes to registersrcPath
- path to the source files of the classeslibPath
- path to the libraries of the application (including dataclayClient)- Returns:
- Registered classes
-
removeClass
public static boolean removeClass(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className)
Method that removes a class from the specified namespace (either removing the imports or because it was actually created in the namespace)- Parameters:
accountID
- ID of the account responsible of the namespace of the classcredential
- Credential of the account responsible of the namespace of the classnamespaceID
- ID of the namespace where the class is presentclassName
- name of the class to be removed from the namespace- Returns:
- TRUE if it was successfully removed. FALSE, otherwise.
-
removeOperation
public static boolean removeOperation(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className, String operationSignature)
Method that removes an operation from the specified namespace- Parameters:
accountID
- ID of the account responsible of the namespace of the class containing the operationcredential
- Credential of the account responsible of the namespace of the class containing the operationnamespaceID
- ID of the namespace of the operation.className
- name of the class of the operationoperationSignature
- signature of the operation.- Returns:
- TRUE if it was successfully removed. FALSE, otherwise.
-
removeImplementation
public static boolean removeImplementation(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, ImplementationID implementationID)
Method that removes an implementation of a certain operation- Parameters:
accountID
- the account of the responsible of the namespacecredential
- the credentials of the accountnamespaceID
- ID of the namespace of the implementationimplementationID
- the id of the implementation- Returns:
- TRUE if it was successfully removed. FALSE, otherwise.
-
getOperationID
public static OperationID getOperationID(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className, String operationSignature)
Method that retrieves the id of an operation given its signature- Parameters:
accountID
- the account of the responsible of the namespacecredential
- the credentials of the accountnamespaceID
- the ID of the namespaceclassName
- the name of the classoperationSignature
- signature of the operation- Returns:
- the operation id if the operation succeeds. null otherwise.
-
getPropertyID
public static PropertyID getPropertyID(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className, String propertyName)
Method that retrieves the id of a property given its signature- Parameters:
accountID
- the account of the responsible of the namespacecredential
- the credentials of the accountnamespaceID
- the ID of the namespaceclassName
- the name of the classpropertyName
- the name of the property- Returns:
- the id of the property if the operation succeeds. null otherwise
-
getClassID
public static MetaClassID getClassID(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className)
Method that retrieves the id of a class given its name- Parameters:
accountID
- the account of the responsible of the namespacecredential
- the credentials of the accountnamespaceID
- the ID of the namespace of the classclassName
- the name of the class- Returns:
- the id of the class if the operation succeeds. null otherwise
-
getClassInfo
public static MetaClass getClassInfo(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, String className)
Method that retrieves the info of a class given its name.- Parameters:
accountID
- the account of the responsible of the namespace.credential
- the credentials of the account.namespaceID
- the ID of the namespace of the class.className
- the name of the class.- Returns:
- the id of the class if the operation succeeds. null otherwise.
-
getClassesInfoInNamespace
public static Map<MetaClassID,MetaClass> getClassesInfoInNamespace(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID)
Method that retrieves the info of the classes registered in a specific namespace.- Parameters:
accountID
- the account of the responsible of the namespace.credential
- the credentials of the account.namespaceID
- the ID of the namespace of the class.- Returns:
- The info of the classes registered in the given namespace.
-
newPrivateContract
public static ContractID newPrivateContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, Contract contract)
Method to register a new private contract.- Parameters:
proprietaryAccountID
- The account of the contract providerproprietaryCredential
- The credential of the contract providercontract
- The specification of a contract. It includes the interfaces that will be part of the contract, the date the contract starts (it becomes active), and the date the contract expires- Returns:
- the contract id if the operation succeeds. null otherwise.
-
newPublicContract
public static ContractID newPublicContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, Contract contract)
Method that registers a new contract- Parameters:
proprietaryAccountID
- The account of the contract providerproprietaryCredential
- The credential of the contract providercontract
- The specification of a contract. It includes the interfaces that will be part of the contract, the date the contract starts (it becomes active), and the date the contract expires- Returns:
- the contract id if the operation succeeds. null otherwise.
-
getContractOfDataClayProvider
public static ContractID getContractOfDataClayProvider(AccountID accountID, PasswordCredential credential)
Return all contracts info of public DataClay provider.- Parameters:
accountID
- ID of the account querying.credential
- Credential of the user.- Returns:
- The info of the contracts of the namespace provider.
-
getContractsOfProvider
public static Map<ContractID,Contract> getContractsOfProvider(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID)
Return all contracts info of the namespace provider.- Parameters:
accountID
- ID of the account of the responsible of the namespace.credential
- Credential of the user.namespaceID
- ID of the namespace provider.- Returns:
- The info of the contracts of the namespace provider.
-
getContractsOfApplicant
public static Map<ContractID,Contract> getContractsOfApplicant(AccountID accountID, PasswordCredential credential)
Return the info of all the contracts of the user (as applicant) specified.- Parameters:
accountID
- ID of the account of the user.credential
- Credential of the user.- Returns:
-
getContractsOfApplicant
public static Map<ContractID,Contract> getContractsOfApplicant(AccountID accountID, PasswordCredential credential, NamespaceID namespaceIDofProvider)
Return the info of all the contracts of the user (as applicant) specified with the namespace provider specified.- Parameters:
accountID
- ID of the account of the user.credential
- Credential of the user.namespaceIDofProvider
- ID of the namespace that provides the contracts to be retrieved.- Returns:
- The info of the contracts of the user specified with the given namespace provider.
-
registerToPublicContract
public static boolean registerToPublicContract(AccountID accountID, PasswordCredential credential, ContractID contractID)
Method to register an account to a contract- Parameters:
accountID
- The account of the applicant for the contractcredential
- The credential of the applicant for the contractcontractID
- ID of the contract in which to register.- Returns:
- TRUE if the account was successfully registered to contract. FALSE, otherwise.
-
registerToPublicContractOfNamespace
public static ContractID registerToPublicContractOfNamespace(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID)
Method to register an account to a contract- Parameters:
accountID
- The account of the applicant for the contractcredential
- The credential of the applicant for the contractnamespaceID
- ID of the namespace to check for a public contract- Returns:
- the contractID corresponding to the public contract of the namespace
-
getStubs
public static Map<String,byte[]> getStubs(AccountID applicantAccountID, PasswordCredential applicantCredential, LinkedList<ContractID> contractsIDs)
Method that allows to retrieve the stubs- Parameters:
applicantAccountID
- the applicant of the contractsapplicantCredential
- the credentials of the applicantcontractsIDs
- the contracts ids of the user- Returns:
- Byte arrays representing stubs and aspects
-
getAndStoreStubs
public static Set<String> getAndStoreStubs(AccountID applicantAccountID, PasswordCredential applicantCredential, LinkedList<ContractID> contractsIDs, String targetDirectoryPath)
Method that allows to retrieve the stubs and prototypes of the given contract and store them to certain directory- Parameters:
applicantAccountID
- the applicant of the contractsapplicantCredential
- the credentials of the applicantcontractsIDs
- the contracts ids of the usertargetDirectoryPath
- the directory path where stubs are saved- Returns:
- Set of name of classes of stubs stored
-
getAndStoreStubsForEnrichment
public static boolean getAndStoreStubsForEnrichment(AccountID applicantAccountID, PasswordCredential applicantCredential, LinkedList<ContractID> contractsIDs, String targetDirectoryPath)
Method that allows to retrieve the stubs FOR ENRICHMENT of the given contract and store them to certain directory- Parameters:
applicantAccountID
- the applicant of the contractsapplicantCredential
- the credentials of the applicantcontractsIDs
- the contracts ids of the usertargetDirectoryPath
- the directory path where stubs are saved- Returns:
- TRUE if it succeeds, FALSE otherwise
-
newInterface
public static InterfaceID newInterface(AccountID accountID, PasswordCredential credential, Interface interfaceSpec)
Method that registers a new interface- Parameters:
accountID
- the account of the responsible of the namespace of the classcredential
- the credentials of the accountinterfaceSpec
- Interface specification- Returns:
- ID of the new interface created or NULL if it failed.
-
removeInterface
public static boolean removeInterface(AccountID accountID, PasswordCredential credential, NamespaceID namespaceID, InterfaceID interfaceID)
Method that removes a specific interface- Parameters:
accountID
- the account of the responsible of the namespace of the interfacecredential
- the credentials of the acountnamespaceID
- ID of the namespace of the interfaceinterfaceID
- the id of the interface to be removed- Returns:
- TRUE if it was successfully removed. FALSE, otherwise.
-
performSetOfNewAccounts
public static byte[] performSetOfNewAccounts(AccountID adminID, PasswordCredential credential, byte[] yamlRequest)
Call that performs a series of account creations, described by one YAML file.- Parameters:
adminID
- The admin AccountID, in order to perform the newAccount calls.credential
- The credential for admin account.yamlRequest
- The YAML file containing the new accounts information.- Returns:
- A YAML payload containing the ID for the new accounts.
-
performSetOfOperations
public static byte[] performSetOfOperations(AccountID performerID, PasswordCredential credential, byte[] yamlRequest)
Call that performs a series of operations (user type), described by one YAML file.- Parameters:
performerID
- The performer AccountID, user responsible for all the operations.credential
- The credential for the performer account.yamlRequest
- The YAML file containing the information for the set of operations.- Returns:
- A YAML payload containing the new dataClay IDs, resulting from this call.
-
getInterfaceInfo
public static Interface getInterfaceInfo(AccountID accountID, PasswordCredential credential, InterfaceID interfaceID)
Method that retrieves the info of the interface if the account is registered in a contract that contains it- Parameters:
accountID
- ID of the account registered in a contract with the interface presentcredential
- the credential of the accountinterfaceID
- the ID of the interface to be retrieved- Returns:
- info of the interface
-
newPrivateDataContract
public static DataContractID newPrivateDataContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, DataContract datacontract)
Method to register a new private data contract.- Parameters:
proprietaryAccountID
- The account of the contract providerproprietaryCredential
- The credential of the contract providerdatacontract
- The specification of a contract. It includes the date the contract starts (it becomes active) and the date the contract expires- Returns:
- the contract id if the operation succeeds. null otherwise.
-
newPublicDataContract
public static DataContractID newPublicDataContract(AccountID proprietaryAccountID, PasswordCredential proprietaryCredential, DataContract datacontract)
Method that registers a new public data contract- Parameters:
proprietaryAccountID
- The account of the contract providerproprietaryCredential
- The credential of the contract providerdatacontract
- The specification of a contract. It includes the date the contract starts (it becomes active) and the date the contract expires- Returns:
- the contract id if the operation succeeds. null otherwise.
-
getDataContractsOfProvider
public static Map<DataContractID,DataContract> getDataContractsOfProvider(AccountID accountID, PasswordCredential credential, DataSetID datasetID)
Return all contracts info of the dataset provider.- Parameters:
accountID
- ID of the account of the responsible of the dataset.credential
- Credential of the user.datasetID
- ID of the dataset provider.- Returns:
- The info of the contracts of the namespace provider.
-
getDataContractsOfApplicant
public static Map<DataContractID,DataContract> getDataContractsOfApplicant(AccountID accountID, PasswordCredential credential)
Return the info of all the data contracts of the user (as applicant) specified.- Parameters:
accountID
- ID of the account of the user.credential
- Credential of the user.- Returns:
-
getDataContractInfoOfApplicantWithProvider
public static DataContract getDataContractInfoOfApplicantWithProvider(AccountID accountID, PasswordCredential credential, DataSetID datasetIDofProvider)
Return the info of all the data contracts of the user (as applicant) specified with the dataset provider specified.- Parameters:
accountID
- ID of the account of the user.credential
- Credential of the user.datasetIDofProvider
- ID of the dataset that provides the contracts to be retrieved.- Returns:
- The info of the data contracts of the user specified with the given dataset provider.
-
registerToPublicDataContract
public static boolean registerToPublicDataContract(AccountID accountID, PasswordCredential credential, DataContractID datacontractID)
Method to register an account to a data contract- Parameters:
accountID
- The account of the applicant for the data contractcredential
- The credential of the applicant for the data contractdatacontractID
- ID of the contract in which to register.- Returns:
- TRUE if the account was successfully registered to data contract. FALSE, otherwise.
-
getExecutionEnvironmentsInfo
public static Map<ExecutionEnvironmentID,ExecutionEnvironment> getExecutionEnvironmentsInfo(CommonMessages.Langs language, boolean forceUpdateCache)
Method that retrieves the info of the execution environments of a specific language- Parameters:
language
- language of the backends to be retrievedforceUpdateCache
- Indicates cache of EEs must be updated- Returns:
- info of the of the execution environments of a specific language, indexed by their ID
-
getBackendNames
public static Set<String> getBackendNames(AccountID accountID, PasswordCredential credential, CommonMessages.Langs backendLanguage)
Method that retrieves the info of the registered backends assuming that they might have 1 storage location and/or 1 exec environment- Parameters:
accountID
- ID of the accountcredential
- credential of the accountbackendLanguage
- Language of the backend.- Returns:
- info of the registered backends indexed by their names
-
registerEventListenerImpl
public static void registerEventListenerImpl(AccountID accountID, PasswordCredential credentials, ECA eventListenerImpl)
Register Event listener implementation i.e. method that must be executed every time a certain event (and its conditions) occurs.- Parameters:
accountID
- ID of the account of the user registering event listener.credentials
- Credentials of the usereventListenerImpl
- Event listener implementation. The user must be the responsible of the implementation.
-
registerExternalDataClay
public static DataClayInstanceID registerExternalDataClay(String dcHost, int dcPort)
Method that registers the info of a dataClay instance- Parameters:
dcHost
- entry port host of the external dataClaydcPort
- entry point port of the external dataClay- Returns:
- ID of external registered dataClay.
-
registerExternalDataClayOverrideAuthority
public static DataClayInstanceID registerExternalDataClayOverrideAuthority(AccountID adminAccountID, PasswordCredential adminCredential, String dcHost, int dcPort, String authority)
ADMIN usage only. Method that registers the info of a dataClay instance but with overriden authority for SSL connections.- Parameters:
adminAccountID
- admin account idadminCredential
- admin credentialsdcHost
- entry port host of the external dataClaydcPort
- entry point port of the external dataClayauthority
- authority to use- Returns:
- ID of external registered dataClay.
-
updateExternalDataClay
public static void updateExternalDataClay(DataClayInstanceID dcID, String dcHost, int dcPort)
Method that updates the info of a dataClay instance (adds new "access")- Parameters:
dcID
- ID of the dataclay to updatedcHost
- entry port host of the external dataClaydcPort
- entry point port of the external dataClay
-
getExternalDataClayID
public static DataClayInstanceID getExternalDataClayID(String dcHost, int dcPort)
Tries to connect to an external dataClay instance and retrieve its ID. *- Parameters:
dcHost
- hostname of the external dataClay instancedcPort
- port of the external dataClay instance- Returns:
- id of the external dataClay instance
-
getDataClayID
public static DataClayInstanceID getDataClayID()
Method that retrieves the current dataClay identifier- Returns:
- id of the current dataClay (current dataClay is which this clientLib is being connected to)
-
importModelsFromExternalDataClay
public static void importModelsFromExternalDataClay(String externalNamespace, DataClayInstanceID extDataClayID)
Import classes in namespace specified from an external dataClay- Parameters:
externalNamespace
- External namespace to getextDataClayID
- External dataClay ID
-
activateTracingInDataClayServices
public static final void activateTracingInDataClayServices()
Activate tracing in dataClay services
-
deactivateTracingInDataClayServices
public static final void deactivateTracingInDataClayServices()
Dectivate tracing
-
activateTracing
public static final void activateTracing(boolean initializeWrapper)
Activate tracing
-
deactivateTracing
public static final void deactivateTracing(boolean finalizeWrapper)
Deactivate tracing
-
getTracesInDataClayServices
public static final void getTracesInDataClayServices()
Get traces in dataClay services and store it in current workspace
-
waitForAsyncRequestToFinish
public static void waitForAsyncRequestToFinish()
Wait for asynchronous requests to finish.
-
-