Package org.wso2.carbon.registry.core.dataaccess

Examples of org.wso2.carbon.registry.core.dataaccess.DataAccessManager


    private void setRegistryDriver(RegistryService registry) {
        try {
            if (registry.getConfigSystemRegistry().getRegistryContext() != null &&
                registry.getConfigSystemRegistry().getRegistryContext().getDataAccessManager()
                        != null) {
                DataAccessManager dataAccessManager =
                        registry.getConfigSystemRegistry().getRegistryContext()
                                .getDataAccessManager();
                if (!(dataAccessManager instanceof JDBCDataAccessManager)) {
                    String msg = "Failed to obtain DB connection. Invalid data access manager.";
                    log.error(msg);
View Full Code Here


            data.setRegistryType(registryType);

            // Extract DB related data from RegistryContext
            if (registryType.equals("embedded")) {
                try {
                    DataAccessManager dataAccessManager =
                            RegistryContext.getBaseInstance().getDataAccessManager();
                    if (!(dataAccessManager instanceof JDBCDataAccessManager)) {
                        String msg = "Failed to obtain DB connection. Invalid data access manager.";
                        log.error(msg);
                        throw new AxisFault(msg);
View Full Code Here

        if (log.isTraceEnabled()) {
            log.trace("Configuring the embedded registry.");
        }

        DataAccessManager dataAccessManager = registryContext.getDataAccessManager();
        if (!(dataAccessManager instanceof JDBCDataAccessManager)) {
            String msg = "Failed to configure the embedded registry. Invalid data access manager.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        NodeGroupLock.init(dataAccessManager);
        Transaction.init(dataAccessManager);

        try {
            if (log.isTraceEnabled()) {
                log.trace("Obtaining a cluster wide database lock.");
            }

            NodeGroupLock.lock(NodeGroupLock.INITIALIZE_LOCK);

            if (log.isTraceEnabled()) {
                log.trace("Cluster wide database lock obtained successfully.");
            }
            if (registryContext.isSetup()) {
                if (!dataAccessManager.isDatabaseExisting()) {
                    // mean the database tables are needed
                    if (log.isTraceEnabled()) {
                        log.trace("Creating database tables.");
                    }
                    try {
                        dataAccessManager.createDatabase();
                    } catch (Exception ex) {
                        String msg = "Error occurred while creating the database";
                        log.error(msg);
                        throw new RegistryException(msg, ex);
                    }
View Full Code Here

     */
    public int addEntry(String path, int parentPathId) throws SQLException, RegistryException {
        ResultSet results = null;
        PreparedStatement ps = null;
        PreparedStatement ps1 = null;
        DataAccessManager dataAccessManager;
        if (CurrentSession.getUserRegistry() != null
                && CurrentSession.getUserRegistry().getRegistryContext() != null) {
            dataAccessManager = CurrentSession.getUserRegistry().getRegistryContext()
                    .getDataAccessManager();
        } else {
View Full Code Here

        }
    }

    // Obtains direct connection to database by passing the connection set on thread local object.
    private Connection getDBConnection() throws SQLException, RegistryException {
        DataAccessManager dataAccessManager;
        if (CurrentSession.getUserRegistry() != null
                && CurrentSession.getUserRegistry().getRegistryContext() != null) {
            dataAccessManager = CurrentSession.getUserRegistry().getRegistryContext()
                    .getDataAccessManager();
        } else {
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here

            // Adding static subscriptions
            List<Subscription> staticSubscriptionList =
                    eventSource.getSubscriptionManager().getStaticSubscriptions();
            for (Iterator<Subscription> iterator = staticSubscriptionList.iterator();
                 iterator.hasNext();) {
                Subscription staticSubscription = iterator.next();
                OMElement staticSubElem =
                        fac.createOMElement("subscription", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                staticSubElem.addAttribute(
                        fac.createOMAttribute("id", nullNS, staticSubscription.getId()));
                OMElement filterElem =
                        fac.createOMElement("filter", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                filterElem.addAttribute(fac.createOMAttribute("source", nullNS,
                        (String) staticSubscription.getFilterValue()));
                filterElem.addAttribute(fac.createOMAttribute("dialect", nullNS,
                        (String) staticSubscription.getFilterDialect()));
                staticSubElem.addChild(filterElem);
                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                    fac.createOMText(expiresElem,
                            ConverterUtil.convertToString(staticSubscription.getExpires()));
                    staticSubElem.addChild(expiresElem);
                }
                evenSourceElem.addChild(staticSubElem);
            }
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                    while (itr.hasNext()) {
                        OMElement propElem = (OMElement) itr.next();
                        String propName =
                                propElem.getAttribute(new QName("name")).getAttributeValue();
                        String propValue =
                                propElem.getAttribute(new QName("value")).getAttributeValue();
                        if (propName != null && !"".equals(propName.trim()) &&
                                propValue != null && !"".equals(propValue.trim())) {

                            propName = propName.trim();
                            propValue = propValue.trim();

                            PasswordManager passwordManager =
                                    PasswordManager.getInstance();
                            String key = eventSource.getName() + "." + propName;

                            if (passwordManager.isInitialized()
                                    && passwordManager.isTokenProtected(key)) {
                                eventSource.putConfigurationProperty(propName, propValue);
                                propValue = passwordManager.resolve(propValue);
                            }

                            manager.addProperty(propName, propValue);
                        }
                    }
                    eventSource.setSubscriptionManager(manager);
                    eventSource.getSubscriptionManager()
                            .init(); // Initialise before doing further processing, required for static subscriptions
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.dataaccess.DataAccessManager

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.