[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-cvs-dev] How to handle rules ?

Title: How to handle rules ?

I have found 2 static classes in my xPlugin class.

They are:

/** the scheduling rule for the whole clearcase engine */
        public static final ISchedulingRule RULE_CLEARCASE_ENGING = new ISchedulingRule() {

                public boolean contains(ISchedulingRule rule) {
                        return RULE_CLEARCASE_ENGING == rule;
                }

                public boolean isConflicting(ISchedulingRule rule) {
                        return RULE_CLEARCASE_ENGING == rule;
                }
        };

        /** the scheduling rule for the refresh jobs */
        public static final ISchedulingRule RULE_CLEARCASE_REFRESH = new ISchedulingRule() {

                public boolean contains(ISchedulingRule rule) {
                        // can contain engine and refresh rules
                        return RULE_CLEARCASE_ENGING == rule
                                        || RULE_CLEARCASE_REFRESH == rule;
                }

                public boolean isConflicting(ISchedulingRule rule) {
                        // conflict with engine
                        // conflict with refresh
                        // conflict with workspace (fix for 1055293)
                        return RULE_CLEARCASE_ENGING == rule
                                        || RULE_CLEARCASE_REFRESH == rule
                                        || getWorkspace().getRuleFactory().buildRule() == rule;
                }
        };

I also see that I set the RULE_CLEARCASE_REFRESH rule for my Job. I guess that this will be my outer rule.
Then when I added the following rule in my refresh state method that is run in the job:

                IResource resource = getStateCache().getResource();
                ISchedulingRule rule = ClearcasePlugin.getWorkspace()
                                .getRuleFactory().refreshRule(resource);
                try {
                        jobManager.beginRule(rule, monitor);
                        resource.refreshLocal(IResource.DEPTH_ZERO,                                     new SubProgressMonitor(monitor, 1));

                } catch (CoreException e) {
                        e.printStackTrace();

                } finally {
                        jobManager.endRule(rule);
                }

I get the following error:

!ENTRY org.eclipse.core.resources 4 1 2009-03-05 14:14:34.750 !MESSAGE Internal Error !STACK 0
java.lang.IllegalArgumentException: Attempted to beginRule:
F/Drive_U/src/com/quantel/QuentinManager, does not match outer scope rule:
net.sourceforge.eclipseccase.ClearcasePlugin$2@16cf69a

I guess that the outer scope is the RULE_CLEARCASE_REFRESH.

Is there anyone that can explain how these rules work?

Cheers,

//mike