/** * * @param key short name of the artifact type. * @param contextName context name of which lifecycle is needed * @param registry registry instance * @return lifecycle of the name associated with the context, null otherwise * @throws RegistryException if the operation failed */ public static String getLifeCycleOfContext(String key, String contextName, Registry registry) throws RegistryException { GovernanceArtifactConfiguration configuration = findGovernanceArtifactConfiguration(key, registry); if(configuration != null) { return configuration.getLifeCycleOfContext(contextName); } return null ; }
public static GenericArtifactManager getArtifactManager(Registry registry, String key) throws RegistryException { GenericArtifactManager artifactManager = null; GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry); if (GovernanceUtils.findGovernanceArtifactConfiguration(key, registry) != null) { artifactManager = new GenericArtifactManager(registry, key); } return artifactManager; }
/** * this method used to initialized the ArtifactManager * * @param registry * Registry * @param key * , key name of the key * @return GenericArtifactManager * @throws org.wso2.carbon.appmgt.api.AppManagementException * if failed to initialized GenericArtifactManager */ public static GenericArtifactManager getArtifactManager(Registry registry, String key) throws AppManagementException { GenericArtifactManager artifactManager = null; try { GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry); if (GovernanceUtils.findGovernanceArtifactConfiguration(key, registry) != null) { artifactManager = new GenericArtifactManager(registry, key); } } catch (RegistryException e) { String msg = "Failed to initialize GenericArtifactManager"; log.error(msg, e); throw new AppManagementException(msg, e); } return artifactManager; }
configuration = GovernanceUtils.findGovernanceArtifactConfiguration(elementString, registry); } catch (RegistryException e) { throw new GovernanceException("Retrieving RXT configuration for type :" + elementString + "failed.", e);
/** * Constructor accepting an instance of the registry, and also details on the type of manager. * * @param registry the instance of the registry. * @param mediaType the media type of resources being saved or fetched. */ protected ServiceManager(Registry registry, String mediaType) throws RegistryException { GovernanceArtifactConfiguration configuration = GovernanceUtils.findGovernanceArtifactConfiguration( GovernanceConstants.SERVICE_ARTIFACT_KEY, registry); this.manager = new GovernanceArtifactManager( registry, mediaType, configuration.getArtifactNameAttribute(), configuration.getArtifactNamespaceAttribute(), configuration.getArtifactElementRoot(), GovernanceConstants.SERVICE_ELEMENT_NAMESPACE, configuration.getPathExpression(), new Association[0]); this.registry = registry; }
/** * Constructor accepting an instance of the registry, and key identifying the type of manager. * * @param registry the instance of the registry. * @param key the key short name of the artifact type. * @throws RegistryException Thrown when rxt configuration is not in registry. */ public GenericArtifactManager(Registry registry, String key) throws RegistryException { try { GovernanceArtifactConfiguration configuration = GovernanceUtils.findGovernanceArtifactConfiguration(key, registry); if (configuration != null) { artifactNameAttribute = configuration.getArtifactNameAttribute(); artifactNamespaceAttribute = configuration.getArtifactNamespaceAttribute(); artifactElementNamespace = configuration.getArtifactElementNamespace(); manager = new GovernanceArtifactManager(registry, configuration.getMediaType(), artifactNameAttribute, artifactNamespaceAttribute, configuration.getArtifactElementRoot(), artifactElementNamespace, configuration.getPathExpression(), configuration.getLifecycle(), configuration.getValidationAttributes(), configuration.getRelationshipDefinitions()); mediaType = configuration.getMediaType(); } else { throw new GovernanceException("Artifact type '" + key + "' is not in registry or unable to find relevant configuration."); } } catch (RegistryException e) { throw new GovernanceException("Unable to obtain governance artifact configuration for rxt: " + key, e); } }