de.uni_leipzig.wifa.iwi.mr3.service.impl
Class ModelRepositoryServiceImpl

Package class diagram package ModelRepositoryServiceImpl
java.lang.Object
  extended by de.uni_leipzig.wifa.iwi.mr3.service.impl.ModelRepositoryServiceImpl
All Implemented Interfaces:
ModelRepositorySkeletonInterface, org.apache.axis2.engine.ServiceLifeCycle, org.apache.axis2.service.Lifecycle

public class ModelRepositoryServiceImpl
extends Object
implements ModelRepositorySkeletonInterface, org.apache.axis2.engine.ServiceLifeCycle, org.apache.axis2.service.Lifecycle

Service implementation for model repository.

This class asks the global configuration (for axis2: axis2.xml) for a configuration parameter "ModelRepository.DatabasePath". Use this parameter to configure the persistence folder. If there is no such folder, we use a static one.


Constructor Summary
ModelRepositoryServiceImpl()
           
 
Method Summary
 Comparison compare(String leftUri, String rightUri)
          Compare two models.
 void delete(String nsUri, boolean cascading)
          Delete model.
 void destroy(org.apache.axis2.context.ServiceContext context)
          On destroy the service context.
 Match[] find(String[] classifiers, String expression, boolean isRegEx, boolean isCaseSensitive)
          Find model by conditions. y
 String[] getInstanceModels(String metaNsUri)
          Find all models.
 void init(org.apache.axis2.context.ServiceContext context)
          Init of service context.
 org.apache.axiom.om.OMElement load(String nsUri)
          Load a model by given namespace URI.
 void save(org.apache.axiom.om.OMElement model, String uri)
          Store model into model repository.
 void shutDown(org.apache.axis2.context.ConfigurationContext configctx, org.apache.axis2.description.AxisService service)
          Service live cycle method.
 void startUp(org.apache.axis2.context.ConfigurationContext configctx, org.apache.axis2.description.AxisService service)
          Service live cycle method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelRepositoryServiceImpl

public ModelRepositoryServiceImpl()
Method Detail

startUp

public void startUp(org.apache.axis2.context.ConfigurationContext configctx,
                    org.apache.axis2.description.AxisService service)
Service live cycle method.

This (callback) method is called by axis2 when the engine starts, before it is initially used. Therefore the first request need not wait until initialization has finished.

Specified by:
startUp in interface org.apache.axis2.engine.ServiceLifeCycle
Parameters:
configctx - Service context
service - Service
See Also:
ServiceLifeCycle.startUp(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.AxisService)

shutDown

public void shutDown(org.apache.axis2.context.ConfigurationContext configctx,
                     org.apache.axis2.description.AxisService service)
Service live cycle method.

Specified by:
shutDown in interface org.apache.axis2.engine.ServiceLifeCycle
Parameters:
configctx - Service context
service - Service
See Also:
ServiceLifeCycle.shutDown(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.AxisService)

init

public void init(org.apache.axis2.context.ServiceContext context)
          throws org.apache.axis2.AxisFault
Init of service context.

Each service class may more then once instantiated for some reasons. Each instance get it's own service context. At time the instance is constructed this method get called. We keep the service context in instance variable for further usage.

Specified by:
init in interface org.apache.axis2.service.Lifecycle
Parameters:
context - Service context
Throws:
org.apache.axis2.AxisFault - Never happens
See Also:
Lifecycle.init(org.apache.axis2.context.ServiceContext)

destroy

public void destroy(org.apache.axis2.context.ServiceContext context)
On destroy the service context.

Specified by:
destroy in interface org.apache.axis2.service.Lifecycle
Parameters:
context - Service context
See Also:
Lifecycle.destroy(org.apache.axis2.context.ServiceContext)

save

public void save(org.apache.axiom.om.OMElement model,
                 String uri)
          throws MRException
Store model into model repository.

If model exists, the parameter override must be true to override the model, otherwise storing fails.

Specified by:
save in interface ModelRepositorySkeletonInterface
Parameters:
model - Model to store into model repository
uri - uri of the model resource, used as name to tag models without nsURI
Throws:
MRException - Service level exception
See Also:
ModelRepositorySkeletonInterface.save(org.apache.axiom.om.OMElement, java.lang.String)

load

public org.apache.axiom.om.OMElement load(String nsUri)
                                   throws MRException
Load a model by given namespace URI.

Specified by:
load in interface ModelRepositorySkeletonInterface
Parameters:
nsUri - Namespace URI
Returns:
Model with the given namespace URI or null if no such model exists in repository
Throws:
MRException - Service level exception
See Also:
ModelRepositorySkeletonInterface.load(java.lang.String)

delete

public void delete(String nsUri,
                   boolean cascading)
            throws MRException
Delete model.

Specified by:
delete in interface ModelRepositorySkeletonInterface
Parameters:
nsUri - Namespace URI of model to delete
cascading - true, if all instance models should also be deleted
Throws:
MRException - Service level exception
See Also:
ModelRepositorySkeletonInterface.delete(java.lang.String, boolean)

getInstanceModels

public String[] getInstanceModels(String metaNsUri)
Find all models.

Lookup the nsURIs of all model instances in repository beyound the model with the given nsURI. If the meta nsURI is unkonown (no such model in repository) or no model is found, the result is empty, not null.

If the argument is null, the method looks up all models explicitly without an assigned meta model. Usually these are meta models, forming the maximum model level in it's context.

Specified by:
getInstanceModels in interface ModelRepositorySkeletonInterface
Parameters:
metaNsUri - Namespace URI of parent model.
Returns:
nsURIs of found models
See Also:
ModelRepositorySkeletonInterface.getInstanceModels(java.lang.String)

find

public Match[] find(String[] classifiers,
                    String expression,
                    boolean isRegEx,
                    boolean isCaseSensitive)
Find model by conditions. y

Specified by:
find in interface ModelRepositorySkeletonInterface
Parameters:
classifiers - the classifiers to search in
expression - the string expression to search for
isRegEx - RegExp search
isCaseSensitive - Case sensitive search
Returns:
Array of found models, matching the given conditions
See Also:
de.uni_leipzig.wifa.iwi.mr3.service.ModelRepositorySkeletonInterface#find(java.lang.String, java.lang.String[], boolean, boolean)

compare

public Comparison compare(String leftUri,
                          String rightUri)
                   throws MRException
Compare two models.

Specified by:
compare in interface ModelRepositorySkeletonInterface
Parameters:
leftUri - Identificator of left model
rightUri - Identificator of right model
Returns:
Commonalities s and differences of the two models
Throws:
MRException - Service level exception
See Also:
de.uni_leipzig.wifa.iwi.mr3.service.ModelRepositorySkeletonInterface#compare(org.apache.axis2.databinding.types.URI, org.apache.axis2.databinding.types.URI)


Copyright © 2010 Uni-Leipzig. All Rights Reserved.