Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.Registry


        }

        HttpServletRequest request =
                (HttpServletRequest) messageContext.getProperty("transport.http.servletRequest");

        Registry registry =
                (Registry) request.getSession().getAttribute(RegistryConstants.USER_REGISTRY);

        if (registry == null) {
            String msg = "User's Registry instance is not found. " +
                    "Creating a anonymous Registry instance for the user.";
View Full Code Here


        } else if ("reject".equals(action)) {
            value = "rejected";
        } else {
            throw new RegistryException("Not a valid action");
        }
        Registry registry = context.getRegistry();
        Association[] associations =
                registry.getAssociations(context.getResourcePath().getPath(), "original");
        if (associations == null) {
            throw new RegistryException("No original resource to approve");
        }
        final Resource resource = context.getRepository().get(associations[0].getDestinationPath());
        resource.setProperty("approval", value);
View Full Code Here

                                    claim.getValue()).append(";");
                        }
                    }
                    resourceContent.append("#");
                }
                Registry registry = requestContext.getRegistry();
                if (registry.resourceExists(path)) {
                    col = (ResourceImpl) registry.get(path);
                    col.setContent(resourceContent.toString());
                }
            } catch (UserStoreException e) {
                log.error("An error occurred while reading profile details", e);
            }
View Full Code Here

            return;
        }
        try {
            // We can't get Registry from Utils, as the MessageContext is not available at
            // activation time.
            Registry configSystemRegistry = registryService.getConfigSystemRegistry();
            if (registry != null && registry == configSystemRegistry) {
                // Handler has already been set.
                return;
            }
            registry = configSystemRegistry;
View Full Code Here

* parent folder considers this collections as its latest version.
*/
public class VersionedCollectionMediaTypeHandler extends Handler {

    public void putChild(RequestContext requestContext) throws RegistryException {
        Registry registry = requestContext.getRegistry();
        String thisCollectionPath = requestContext.getParentPath();
        String thisCollectionName = RegistryUtils.getResourceName(thisCollectionPath);
        String parentContainerPath = RegistryUtils.getParentPath(thisCollectionPath);
        Resource parentContainer = registry.get(parentContainerPath);

        if (thisCollectionName.equals(parentContainer.getProperty(
                CommonConstants.LATEST_VERSION_PROP_NAME))) {
            String resourcePath = requestContext.getResourcePath().getPath();
            String resourceName = RegistryUtils.getResourceName(resourcePath);
            registry.createLink(parentContainerPath + RegistryConstants.PATH_SEPARATOR +
                    resourceName, resourcePath);
        }
    }
View Full Code Here

        }

        HttpServletRequest request =
                (HttpServletRequest) messageContext.getProperty("transport.http.servletRequest");

        Registry registry =
                (Registry) request.getSession().getAttribute(RegistryConstants.USER_REGISTRY);

        if (registry == null) {

            String msg = "User's Registry instance is not found. " +
View Full Code Here

public final static String SERVELT_SESSION = "comp.mgt.servlet.session";

    public Registry getRootRegistry() {
        if (getHttpSession() != null) {
            Registry registry =
                    (Registry) getHttpSession().getAttribute(
                            RegistryConstants.ROOT_REGISTRY_INSTANCE);
            if (registry != null) {
                return registry;
            }
View Full Code Here

        }
        return null;
    }

    public Registry getRootRegistry(RegistryService registryService) {
        Registry registry = getRootRegistry();
        if (registry != null) {
            return registry;
        }
        HttpSession httpSession =
                (HttpSession) MessageContext.getCurrentMessageContext().getProperty(SERVELT_SESSION);
View Full Code Here

    return fileContents.toString();
  }

  private void setServiceFileHashInRegistry(String serviceGroupName, String hash)
      throws Exception {
    Registry registry = this.getConfigSystemRegistry();
    if (registry == null) {
      throw new Exception("WSO2 Registry is not available");
    }
    boolean transactionStarted = Transaction.isStarted();
    try {
      if (transactionStarted) {
        registry.beginTransaction();
      }
      String serviceResourcePath = RegistryResources.SERVICE_GROUPS + serviceGroupName;
      /* the resource should already exist */
      if (registry.resourceExists(serviceResourcePath)) {
        Resource serviceResource = registry.get(serviceResourcePath);
        serviceResource.setProperty(RegistryResources.ServiceGroupProperties.HASH_VALUE,
            hash);
        registry.put(serviceResourcePath, serviceResource);
        serviceResource.discard();
      }
      if (transactionStarted) {
        registry.commitTransaction();
      }
    } catch (Throwable e) {
      if (transactionStarted) {
        registry.rollbackTransaction();
      }
      log.error("Unable to set the hash value property to service group "
          + serviceGroupName);
      throw new Exception(e);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Subscriber retrieve(String subscriberId) {
        Registry systemRegistry = null;
        Resource resource = null;

        try {
            systemRegistry = EventingServiceComponent.getRegistry();

            if (systemRegistry.resourceExists(EVENTING_ROOT + serviceName + "/subscribers/"
                    + subscriberId)) {
                resource = systemRegistry.get(EVENTING_ROOT + serviceName + "/subscribers/"
                        + subscriberId);
                return getSubscriber(resource);
            }

        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.Registry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.