Examples of HibernateTxFragment


Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

        currentNodeIpAddress = getIPAddress();

        log.info("Registering cluster node with ip address " + currentNodeIpAddress);

        final ClusterNode[] result = new ClusterNode[1];
        new HibernateTxFragment(true, true) {
            protected void txFragment(Session session) throws Exception {

                // Check if the node is already regisitered from a previous execution.
                ClusterNode node = getNodeByIpAddress(currentNodeIpAddress);
View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

            return;
        }

        log.info("Deregistering cluster node with id " + nodeId);

        new HibernateTxFragment(true, true) {
            protected void txFragment(Session session) throws Exception {
                // Delete the cluster node register.
                Query query = session.createQuery("delete from " + ClusterNode.class.getName() +" cn  where cn.id = :idNode");
                query.setLong("idNode", nodeId);
                query.executeUpdate();
View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

     * @throws Exception Error searching for a cluster node by status.
     */
    public List<ClusterNode> getNodeByStatus(final ClusterNode.ClusterNodeStatus status) throws  Exception {
        final List<ClusterNode> result = new ArrayList<ClusterNode>();
        if (status != null) {
            new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    Query query = session.createQuery("from " + ClusterNode.class.getName() +" cn  where cn.nodeStatus = :nStatus");
                    query.setString("nStatus", status.name());
                    List queryResult = query.list();

View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

     * @throws Exception Error searching for a cluster node by identifier.
     */
    public ClusterNode getNodeById(final Long id) throws  Exception {
        final ClusterNode[] result = new ClusterNode[1];
        if (id != null) {
            new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    Query query = session.createQuery("from " + ClusterNode.class.getName() +"  cn  where cn.id = :idToSearch");
                    query.setLong("idToSearch", id);
                    List queryResult = query.list();

View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

     * @throws Exception Error searching for a cluster node by ip address.
     */
    public ClusterNode getNodeByIpAddress(final String ip) throws  Exception {
        final ClusterNode[] result = new ClusterNode[1];
        if (ip != null) {
            new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    Query query = session.createQuery("from " + ClusterNode.class.getName() +"  cn  where cn.nodeAddress = :ipToSearch");
                    query.setString("ipToSearch", ip);
                    List queryResult = query.list();

View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

     *
     * @param nodeId The node identifier.
     * @param newStatus The new status to set.
     */
    public void setNodeStatus(final Long nodeId, final ClusterNode.ClusterNodeStatus newStatus) throws Exception{
        new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                ClusterNode node = getNodeById(nodeId);

                if (node == null) {
                    log.error("Cannot set status " + newStatus.name() + " to target node. Node with identifier " + nodeId + " not found.");
View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

     * @return If this node should install initial modules.
     */
    public boolean shouldInstallModules() throws Exception {
        final Boolean[] result = new Boolean[1];
        result[0] = true;
        new HibernateTxFragment(true, true) {
            protected void txFragment(Session session) throws Exception {
                List<ClusterNode> installingModulesNodes = getNodeByStatus(ClusterNode.ClusterNodeStatus.INSTALLING_MODULES);
                if (installingModulesNodes != null && !installingModulesNodes.isEmpty()) {
                    if (installingModulesNodes.size() > 1) {
                        log.warn("More than one cluster node status is INSTALLING_MODULES. This situation can be produced due to a failured previous installation.");
View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

    }

    public synchronized void execute(final SchedulerTask task, boolean onlyIfCommit) {
        try {
            if (onlyIfCommit) {
                new HibernateTxFragment(false, true) {
                protected void beforeCommit() throws Throwable {
                    _schedule(task, null);
                }}.execute();
            } else {
                _schedule(task, null);
View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

                return;
            }

            List<InitialModule> modules = initialModuleRegistry.getInitialModulesRegistered();
            for (final InitialModule module : modules) {
                new HibernateTxFragment(true) {
                    protected void txFragment(Session session) throws Exception {
                        InstalledModule currentVersion = (InstalledModule) session.get(InstalledModule.class, module.getName(), LockOptions.UPGRADE);

                        // The module is not registered => Install it!
                        if (currentVersion == null) {
View Full Code Here

Examples of org.jboss.dashboard.database.hibernate.HibernateTxFragment

     * IMPORTANT NOTE: Perform the change node status in bbdd in a new transaction.
     *
     * NOTE: BZ-1014612
     */
    protected void finishInstallation() throws Exception {
        new HibernateTxFragment(true) {
            protected void txFragment(Session session) throws Exception {
                clusterNodesManager.setCurrentNodeStatus(ClusterNode.ClusterNodeStatus.REGISTERED);
            }

        }.execute();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.