<?xml version="1.0"?>
<!-- 
// $Id: //open/dev/farrago/src/macker.xml#65 $
// Farrago is an extensible data management system.
// Copyright (C) 2005-2009 The Eigenbase Project
// Copyright (C) 2005-2009 SQLstream, Inc.
// Copyright (C) 2005-2009 LucidEra, Inc.
// Portions Copyright (C) 2003-2009 John V. Sichi
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later Eigenbase-approved version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//  
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307  USA
-->

<macker>
  <ruleset name="Layering rules">
    <!-- libraries -->

    <pattern name="eigenbase">
      <include class="org.eigenbase.****" />
    </pattern>

    <pattern name="util14" >
      <include class="org.eigenbase.util14.*" />
      <include class="org.eigenbase.util.property.*" />
      <include class="org.eigenbase.util.EigenbaseException" />
      <include class="org.eigenbase.jdbc4.*" />
    </pattern>

    <pattern name="farrago">
      <include class="net.sf.farrago.****" />
      <include class="com.disruptivetech.****" />
      <include class="com.lucidera.****" />
    </pattern>

    <!-- farrago components -->
    <pattern name="cwm" class="net.sf.farrago.cwm.***" />
    <pattern name="fem" class="net.sf.farrago.fem.***" />
    <pattern name="FarragoPackage">
      <include class="net.sf.farrago.FarragoPackage" />
      <include class="net.sf.farrago.FarragoMetadataFactory" />
      <include class="net.sf.farrago.FarragoMetadataFactoryImpl" />
    </pattern>
    <pattern name="trace" class="net.sf.farrago.trace.*" />
    <pattern name="release" class="net.sf.farrago.release.*" />
    <pattern name="util" class="net.sf.farrago.util.*" />
    <pattern name="resource" class="net.sf.farrago.resource.*" />
    <pattern name="catalog.codegen" class="net.sf.farrago.catalog.codegen.*" />
    <pattern name="catalog" class="net.sf.farrago.catalog.*" />
    <pattern name="plugin" class="net.sf.farrago.plugin.*" />
    <pattern name="type" class="net.sf.farrago.type.*" />
    <pattern name="type.runtime" class="net.sf.farrago.type.runtime.*" />
    <pattern name="namespace" class="net.sf.farrago.namespace.*" />
    <pattern name="namespace.util" class="net.sf.farrago.namespace.util.*" />
    <pattern name="fennel" class="net.sf.farrago.fennel.*" />
    <pattern name="fennel.calc" class="net.sf.farrago.fennel.calc.*" />
    <pattern name="fennel.tuple" class="net.sf.farrago.fennel.tuple.*" />
    <pattern name="fennel.rel" class="net.sf.farrago.fennel.rel.*" />
    <pattern name="session" class="net.sf.farrago.session.*" />
    <pattern name="session.mock" class="net.sf.farrago.session.mock.*" />
    <pattern name="runtime" class="net.sf.farrago.runtime.*" />
    <pattern name="dynamic" class="net.sf.farrago.dynamic.*" />
    <pattern name="ojrex" class="net.sf.farrago.ojrex.*" />
    <pattern name="query" class="net.sf.farrago.query.*" />
    <pattern name="ddl" class="net.sf.farrago.ddl.*" />
    <pattern name="ddl.gen" class="net.sf.farrago.ddl.gen.*" />
    <pattern name="parser" class="net.sf.farrago.parser.**" />
    <pattern name="db" class="net.sf.farrago.db.*" />
    <pattern name="jdbc" class="net.sf.farrago.jdbc.*" />
    <pattern name="jdbc.engine" class="net.sf.farrago.jdbc.engine.*" />
    <pattern name="jdbc.client" class="net.sf.farrago.jdbc.client.*" />
    <pattern name="jdbc.rmi" class="net.sf.farrago.jdbc.rmi.*" />
    <pattern name="jdbc.param" class="net.sf.farrago.jdbc.param.*" />
    <pattern name="server" class="net.sf.farrago.server.*" />
    <pattern name="namespace.impl" class="net.sf.farrago.namespace.impl.*" />
    <pattern name="namespace.mdr" class="net.sf.farrago.namespace.mdr.*" />
    <pattern name="namespace.mock" class="net.sf.farrago.namespace.mock.*" />
    <pattern name="namespace.jdbc" class="net.sf.farrago.namespace.jdbc.*" />
    <pattern name="namespace.ftrs" class="net.sf.farrago.namespace.ftrs.*" />
    <pattern name="namespace.flatfile" class="net.sf.farrago.namespace.flatfile.*" />

    <pattern name="lu.jdbc" class="com.lucidera.jdbc.*"/>
    <pattern name="lu.lcs" class="com.lucidera.lcs.*"/>
    <pattern name="lu.lurql" class="com.lucidera.lurql.*"/>

    <pattern name="lu.farrago" class="com.lucidera.farrago.*"/>
    <pattern name="lu.fennel" class="com.lucidera.farrago.fennel.*" />
    <pattern name="lu.namespace.flatfile" class="com.lucidera.farrago.namespace.flatfile.*" />
    <pattern name="lu.opt" class="com.lucidera.opt.*" />
    <pattern name="lu.opt.test" class="com.lucidera.opt.test.*" />
    <pattern name="lu.query" class="com.lucidera.query.*" />
    <pattern name="lu.runtime" class="com.lucidera.runtime.*" />
    <pattern name="lu.type" class="com.lucidera.type.*" />

    <pattern name="defimpl" class="net.sf.farrago.defimpl.*" />

    <pattern name="test" class="net.sf.farrago.test.**" />

    <pattern name="dt.test" class="com.disruptivetech.farrago.test.*" />

    <pattern name="lu.test" class="com.lucidera.farrago.test.*" />

    <pattern name="plannerviz" class="net.sf.farrago.plannerviz.**" />
    
    <pattern name="syslib" class="net.sf.farrago.syslib.**" />

    <!-- explicit list of all farrago components above -->
    <pattern name="farrago.explicit">
      <include pattern="cwm"/>
      <include pattern="fem"/>
      <include pattern="FarragoPackage"/>
      <include pattern="trace"/>
      <include pattern="release"/>
      <include pattern="util"/>
      <include pattern="resource"/>
      <include pattern="catalog.codegen"/>
      <include pattern="catalog"/>
      <include pattern="plugin"/>
      <include pattern="type"/>
      <include pattern="type.runtime"/>
      <include pattern="namespace"/>
      <include pattern="namespace.util"/>
      <include pattern="fennel"/>
      <include pattern="fennel.calc" />
      <include pattern="fennel.rel" />
      <include pattern="fennel.tuple" />
      <include pattern="session"/>
      <include pattern="session.mock"/>
      <include pattern="runtime"/>
      <include pattern="dynamic"/>
      <include pattern="ojrex"/>
      <include pattern="query"/>
      <include pattern="ddl"/>
      <include pattern="ddl.gen"/>
      <include pattern="parser"/>
      <include pattern="db"/>
      <include pattern="jdbc"/>
      <include pattern="jdbc.engine"/>
      <include pattern="jdbc.client"/>
      <include pattern="jdbc.rmi"/>
      <include pattern="jdbc.param"/>
      <include pattern="server"/>
      <include pattern="namespace.impl"/>
      <include pattern="namespace.mdr"/>
      <include pattern="namespace.mock"/>
      <include pattern="namespace.jdbc"/>
      <include pattern="namespace.ftrs"/>
      <include pattern="namespace.flatfile"/>
      <include pattern="lu.jdbc"/>
      <include pattern="lu.lcs"/>
      <include pattern="lu.lurql"/>
      <include pattern="lu.farrago"/>
      <include pattern="lu.fennel"/>
      <include pattern="lu.namespace.flatfile"/>
      <include pattern="lu.opt"/>
      <include pattern="lu.opt.test"/>
      <include pattern="lu.query"/>
      <include pattern="lu.runtime"/>
      <include pattern="lu.type"/>
      <include pattern="defimpl"/>
      <include pattern="test"/>
      <include pattern="dt.test"/>
      <include pattern="lu.test"/>
      <include pattern="plannerviz"/>
      <include pattern="syslib"/>
    </pattern>

    <!-- Below are the actual rules. -->
    <!-- We define a COMPONENT.deps pattern for each component; -->
    <!-- these can be reused in other patterns, avoiding explict -->
    <!-- transitive closure.  The components are topologically -->
    <!-- sorted, starting from those which depend on nothing. -->

    <pattern name="FarragoPackage.deps">
      <include pattern="FarragoPackage" />
      <include pattern="cwm" />
      <include pattern="fem" />
    </pattern>

    <!-- NOTE:  we don't enforce any rules on what generated classes in
         FarragoPackage can depend on; this is to allow extensions. -->

    <pattern name="release.deps">
      <include pattern="release" />
    </pattern>

    <access-rule>
      <message>release dependency violation</message>
      <deny>
        <from pattern="release" />
        <to pattern="eigenbase" />
        <allow>
          <to pattern="util14" />
        </allow>
      </deny>
      <deny>
        <from pattern="release" />
        <to pattern="farrago" />
        <allow>
          <to pattern="release.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="util.deps">
      <include pattern="trace" />
      <include pattern="util" />
      <include pattern="release" />
    </pattern>

    <!-- NOTE:  trace is a special case, allowing for a circular dependency
         with just about anything, but not transitively -->

    <access-rule>
      <message>util dependency violation</message>
      <deny>
        <from pattern="util" />
        <to pattern="farrago" />
        <allow>
          <to pattern="util.deps" />
        </allow>
      </deny>
    </access-rule>

    <!-- special-case rule to enforce FarragoException restrictions -->
    <access-rule>
      <message>FarragoException dependency violation</message>
      <deny>
        <from class="net.sf.farrago.util.FarragoException" />
        <to pattern="farrago" />
      </deny>
    </access-rule>

    <pattern name="resource.deps">
      <include pattern="util.deps" />
      <include pattern="resource" />
    </pattern>

    <access-rule>
      <message>resource dependency violation</message>
      <deny>
        <from pattern="resource" />
        <to pattern="farrago" />
        <allow>
          <to pattern="resource.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="catalog.codegen.deps">
      <include pattern="FarragoPackage.deps" />
      <include pattern="util.deps" />
      <include pattern="catalog.codegen" />
      <include class="net.sf.farrago.catalog.FarragoModelLoader" />
    </pattern>

    <access-rule>
      <message>catalog.codegen dependency violation</message>
      <deny>
        <from pattern="catalog.codegen" />
        <to pattern="farrago" />
        <allow>
          <to pattern="catalog.codegen.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="catalog.deps">
      <include pattern="FarragoPackage.deps" />
      <include pattern="resource.deps" />
      <include pattern="catalog" />
    </pattern>

    <access-rule>
      <message>catalog dependency violation</message>
      <deny>
        <from pattern="catalog" />
        <to pattern="farrago" />
        <allow>
          <to pattern="catalog.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="plugin.deps">
      <include pattern="catalog.deps" />
      <include pattern="plugin" />
    </pattern>

    <access-rule>
      <message>plugin dependency violation</message>
      <deny>
        <from pattern="plugin" />
        <to pattern="farrago" />
        <allow>
          <to pattern="plugin.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="type.runtime.deps">
      <include pattern="resource.deps" />
      <include pattern="type.runtime" />
    </pattern>

    <access-rule>
      <message>type.runtime dependency violation</message>
      <deny>
        <from pattern="type.runtime" />
        <to pattern="farrago" />
        <allow>
          <to pattern="type.runtime.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="type.deps">
      <include pattern="catalog.deps" />
      <include pattern="type.runtime.deps" />
      <include pattern="type" />
    </pattern>

    <access-rule>
      <message>type dependency violation</message>
      <deny>
        <from pattern="type" />
        <to pattern="farrago" />
        <allow>
          <to pattern="type.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="fennel.deps">
      <include pattern="resource.deps" />
      <include pattern="FarragoPackage.deps" />
      <include pattern="fennel" />
      <include pattern="fennel.tuple" />
    </pattern>

    <access-rule>
      <message>fennel dependency violation</message>
      <deny>
        <from pattern="fennel" />
        <to pattern="farrago" />
        <allow>
          <to pattern="fennel.deps" />
        </allow>
      </deny>
    </access-rule>
    
    <pattern name="fennel.tuple.deps"> 
      <include pattern="release.deps" /> 
      <include pattern="fennel.tuple" />
    </pattern> 
 
    <access-rule> 
      <message>fennel.tuple dependency violation</message> 
      <deny>
        <from pattern="fennel.tuple" />
        <to pattern="eigenbase" />
        <allow>
          <to pattern="util14" />
        </allow>
      </deny>
      <deny> 
        <from pattern="fennel.tuple" /> 
        <to pattern="farrago" /> 
        <allow> 
          <to pattern="fennel.tuple.deps" /> 
        </allow> 
      </deny> 
    </access-rule> 
    
    <pattern name="namespace.deps">
      <include pattern="type.deps" />
      <include pattern="fennel.deps" />
      <include pattern="plugin.deps" />
      <include pattern="jdbc" />
      <include pattern="namespace" />
    </pattern>

    <access-rule>
      <message>namespace dependency violation</message>
      <deny>
        <from pattern="namespace" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.util.deps">
      <include pattern="namespace.deps" />
      <include pattern="namespace.util" />
    </pattern>

    <access-rule>
      <message>namespace.util dependency violation</message>
      <deny>
        <from pattern="namespace" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.util.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="session.deps">
      <include pattern="namespace.util.deps" />
      <include pattern="fennel.deps" />
      <include pattern="session" />
    </pattern>

    <access-rule>
      <message>session dependency violation</message>
      <deny>
        <from pattern="session" />
        <to pattern="farrago" />
        <allow>
          <to pattern="session.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="session.mock.deps">
      <include pattern="session.deps" />
      <include pattern="session.mock" />
    </pattern>

    <access-rule>
      <message>session.mock dependency violation</message>
      <deny>
        <from pattern="session.mock" />
        <to pattern="farrago" />
        <allow>
          <to pattern="session.mock.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="jdbc.param.deps">
      <include pattern="fennel.tuple.deps" />
      <include pattern="jdbc.param" />
    </pattern>

    <access-rule>
      <message>jdbc.param dependency violation</message>
      <deny>
        <from pattern="jdbc.param" />
        <to pattern="eigenbase" />
        <allow>
          <to pattern="util14" />
        </allow>
      </deny>
      <deny>
        <from pattern="jdbc.param" />
        <to pattern="farrago" />
        <allow>
          <to pattern="jdbc.param.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="runtime.deps">
      <include pattern="jdbc.param.deps" />
      <include pattern="session.deps" />
      <include pattern="runtime" />
    </pattern>

    <access-rule>
      <message>runtime dependency violation</message>
      <deny>
        <from pattern="runtime" />
        <to pattern="farrago" />
        <allow>
          <to pattern="runtime.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="dynamic.deps">
      <include pattern="runtime.deps" />
      <include pattern="dynamic" />
    </pattern>

    <!-- NOTE:  this is an unenforced guideline for generated code -->
    <access-rule>
      <message>dynamic dependency violation</message>
      <deny>
        <from pattern="dynamic" />
        <to pattern="farrago" />
        <allow>
          <to pattern="dynamic.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="ojrex.deps">
      <include pattern="session.deps" />
      <include pattern="ojrex" />
    </pattern>

    <access-rule>
      <message>ojrex dependency violation</message>
      <deny>
        <from pattern="ojrex" />
        <to pattern="farrago" />
        <allow>
          <to pattern="ojrex.deps" />
        </allow>
      </deny>
    </access-rule>

    <!-- TODO:  break circular dependency with fennel.rel -->

    <pattern name="query.deps">
      <include pattern="dynamic.deps" />
      <include pattern="ojrex.deps" />
      <include pattern="fennel.rel" />
      <include pattern="fennel.tuple" />
      <include pattern="namespace.impl" />
      <include pattern="query" />
    </pattern>

    <access-rule>
      <message>query dependency violation</message>
      <deny>
        <from pattern="query" />
        <to pattern="farrago" />
        <allow>
          <to pattern="query.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="ddl.deps">
      <include pattern="query.deps" />
      <include pattern="ddl" />
    </pattern>

    <access-rule>
      <message>ddl dependency violation</message>
      <deny>
        <from pattern="ddl" />
        <to pattern="farrago" />
        <allow>
          <to pattern="ddl.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="ddl.gen.deps">
      <include pattern="cwm" />
      <include pattern="fem" />
      <include pattern="eigenbase" />
      <include pattern="ddl.gen" />
    </pattern>

    <access-rule>
      <message>ddl.gen dependency violation</message>
      <deny>
        <from pattern="ddl.gen" />
        <to pattern="farrago" />
        <allow>
          <to pattern="ddl.gen.deps" />
        </allow>
      </deny>
    </access-rule>
   
    <pattern name="parser.deps">
      <include pattern="ddl.deps" />
      <include pattern="parser" />
    </pattern>

    <access-rule>
      <message>parser dependency violation</message>
      <deny>
        <from pattern="parser" />
        <to pattern="farrago" />
        <allow>
          <to pattern="parser.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="db.deps">
      <include pattern="parser.deps" />
      <include pattern="db" />
    </pattern>

    <access-rule>
      <message>db dependency violation</message>
      <deny>
        <from pattern="db" />
        <to pattern="farrago" />
        <allow>
          <to pattern="db.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="jdbc.deps">
      <include pattern="release.deps" />
      <include pattern="jdbc" />
    </pattern>

    <access-rule>
      <message>jdbc dependency violation</message>
      <deny>
        <from pattern="jdbc" />
        <to pattern="eigenbase" />
        <allow>
          <to pattern="util14" />
        </allow>
        <allow>
            <to>
              <include class="org.eigenbase.util.EigenbaseContextException" />
            </to>
        </allow>
      </deny>
      <deny>
        <from pattern="jdbc" />
        <to pattern="farrago" />
        <allow>
          <to pattern="jdbc.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="jdbc.engine.deps">
      <include pattern="db.deps" />
      <include pattern="jdbc.deps" />
      <include pattern="jdbc.param.deps" />
      <include pattern="jdbc.engine" />
    </pattern>

    <access-rule>
      <message>jdbc.engine dependency violation</message>
      <deny>
        <from pattern="jdbc.engine" />
        <to pattern="farrago" />
        <allow>
          <to pattern="jdbc.engine.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="jdbc.rmi.deps">
      <include pattern="jdbc.deps" />
      <include pattern="jdbc.rmi" />
    </pattern>

    <access-rule>
      <message>jdbc.rmi dependency violation</message>
      <deny>
        <from pattern="jdbc.rmi" />
        <to pattern="eigenbase" />
        <allow>
          <to pattern="util14" />
        </allow>
      </deny>
      <deny>
        <from pattern="jdbc.rmi" />
        <to pattern="farrago" />
        <allow>
          <to pattern="jdbc.rmi.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="jdbc.client.deps">
      <include pattern="jdbc.deps" />
      <include pattern="fennel.tuple.deps" />
      <include pattern="jdbc.rmi.deps" />
      <include pattern="jdbc.client" />
    </pattern>

    <access-rule>
      <message>jdbc.client dependency violation</message>
      <deny>
        <from pattern="jdbc.client" />
        <to pattern="eigenbase" />
        <allow>
          <to pattern="util14" />
        </allow>
      </deny>
      <deny>
        <from pattern="jdbc.client" />
        <to pattern="farrago" />
        <allow>
          <to pattern="jdbc.client.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="server.deps">
      <include pattern="jdbc.engine.deps" />
      <include pattern="jdbc.rmi" />
      <include pattern="server" />
    </pattern>

    <access-rule>
      <message>server dependency violation</message>
      <deny>
        <from pattern="server" />
        <to pattern="farrago" />
        <allow>
          <to pattern="server.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.impl.deps">
      <include pattern="query.deps" />
      <include pattern="namespace.impl" />
    </pattern>

    <access-rule>
      <message>namespace.impl dependency violation</message>
      <deny>
        <from pattern="namespace.impl" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.impl.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.jdbc.deps">
      <include pattern="namespace.impl.deps" />
      <include pattern="jdbc.engine" />
      <include pattern="namespace.jdbc" />
    </pattern>

    <access-rule>
      <message>namespace.jdbc dependency violation</message>
      <deny>
        <from pattern="namespace.jdbc" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.jdbc.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.ftrs.deps">
      <include pattern="namespace.impl.deps" />
      <include pattern="namespace.ftrs" />
    </pattern>

    <access-rule>
      <message>namespace.ftrs dependency violation</message>
      <deny>
        <from pattern="namespace.ftrs" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.ftrs.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.flatfile.deps">
      <include pattern="namespace.impl.deps" />
      <include pattern="namespace.flatfile" />
    </pattern>

    <access-rule>
      <message>namespace.flatfile dependency violation</message>
      <deny>
        <from pattern="namespace.flatfile" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.flatfile.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.mdr.deps">
      <include pattern="namespace.impl.deps" />
      <include pattern="namespace.mdr" />
    </pattern>

    <access-rule>
      <message>namespace.mdr dependency violation</message>
      <deny>
        <from pattern="namespace.mdr" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.mdr.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="namespace.mock.deps">
      <include pattern="namespace.impl.deps" />
      <include pattern="namespace.mock" />
    </pattern>

    <access-rule>
      <message>namespace.mock dependency violation</message>
      <deny>
        <from pattern="namespace.mock" />
        <to pattern="farrago" />
        <allow>
          <to pattern="namespace.mock.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="fennel.calc.deps">
      <include pattern="resource.deps" />
      <include pattern="fennel.calc" />
      <include pattern="fennel.tuple" />
      <include pattern="session" />
    </pattern>

    <access-rule>
      <message>fennel.calc dependency violation</message>
      <deny>
        <from pattern="fennel.calc" />
        <to pattern="farrago" />
        <allow>
          <to pattern="fennel.calc.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="fennel.rel.deps">
      <include pattern="query.deps" />
      <include pattern="fennel.calc.deps" />
      <include pattern="fennel.rel" />
    </pattern>

    <access-rule>
      <message>fennel.rel dependency violation</message>
      <deny>
        <from pattern="fennel.rel" />
        <to pattern="farrago" />
        <allow>
          <to pattern="fennel.rel.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.fennel.deps">
      <include pattern="lu.fennel" />
    </pattern>

    <access-rule>
      <message>lu.fennel dependency violation</message>
      <deny>
        <from pattern="lu.fennel" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.fennel.deps" />
        </allow>
      </deny>
    </access-rule>

    <!-- FIXME jvs 29-July-2006:  eliminate circularity -->
    <pattern name="lu.jdbc.deps">
      <include pattern="lu.farrago" />
      <include pattern="jdbc.engine.deps" />
      <include pattern="jdbc.client.deps" />
      <include pattern="lu.jdbc" />
    </pattern>

    <access-rule>
      <message>lu.jdbc dependency violation</message>
      <deny>
        <from pattern="lu.jdbc" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.jdbc.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.lcs.deps">
      <include pattern="namespace.impl.deps" />
      <include pattern="lu.farrago" />
      <include pattern="lu.query" />
      <include pattern="lu.lcs" />
    </pattern>

    <access-rule>
      <message>lu.lcs dependency violation</message>
      <deny>
        <from pattern="lu.lcs" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.lcs.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.lurql.deps">
      <include pattern="lu.lurql" />
      <include pattern="util" />
    </pattern>

    <access-rule>
      <message>lu.lurql dependency violation</message>
      <deny>
        <from pattern="lu.lurql" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.lurql.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.namespace.flatfile.deps">
      <include pattern="namespace.flatfile.deps" />
      <include pattern="lu.namespace.flatfile" />
    </pattern>

    <access-rule>
      <message>lu.namespace.flatfile dependency violation</message>
      <deny>
        <from pattern="lu.namespace.flatfile" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.namespace.flatfile.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.opt.deps">
      <include pattern="lu.lcs.deps" />
      <include pattern="namespace.flatfile.deps" />
      <include pattern="fennel.rel.deps" />
      <include pattern="lu.opt" />
    </pattern>

    <access-rule>
      <message>lu.opt dependency violation</message>
      <deny>
        <from pattern="lu.opt" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.opt.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.opt.test.deps">
      <include pattern="lu.opt.deps" />
      <include pattern="lu.opt.test" />
      <include pattern="jdbc.engine" />
      <include pattern="test" />
    </pattern>

    <access-rule>
      <message>lu.opt.test dependency violation</message>
      <deny>
        <from pattern="lu.opt.test" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.opt.test.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="defimpl.deps">
      <include pattern="db.deps" />
      <include pattern="fennel.calc.deps" />
      <include pattern="fennel.rel.deps" />
      <include pattern="lu.fennel.deps" />
      <include pattern="lu.opt.deps" />
      <include pattern="defimpl" />
    </pattern>

    <access-rule>
      <message>defimpl dependency violation</message>
      <deny>
        <from pattern="defimpl" />
        <to pattern="farrago" />
        <allow>
          <to pattern="defimpl.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.farrago.deps">
      <include pattern="lu.farrago" />
      <include pattern="lu.lcs" />
      <include pattern="lu.opt" />
      <include pattern="lu.query" />
      <include pattern="lu.runtime" />
      <include pattern="lu.jdbc" />
      <include pattern="lu.type" />
      <include pattern="lu.fennel.deps" />
      <include pattern="server" />
      <include pattern="fennel.rel.deps" />
      <include pattern="db.deps" />
      <include pattern="defimpl" />
    </pattern>

    <access-rule>
      <message>lu.farrago dependency violation</message>
      <deny>
        <from pattern="lu.farrago" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.farrago.deps" />
        </allow>
      </deny>
    </access-rule>

    <!-- FIXME jvs 29-July-2006:  eliminate circularity -->
    <pattern name="lu.query.deps">
      <include pattern="lu.farrago.deps" />
      <include pattern="lu.query" />
    </pattern>

    <access-rule>
      <message>lu.opt dependency violation</message>
      <deny>
        <from pattern="lu.query" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.query.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="test.deps">
      <include pattern="server.deps" />
      <include pattern="jdbc.client.deps" />
      <include pattern="defimpl.deps" />
      <include pattern="namespace.mdr.deps" />
      <include pattern="fennel.tuple" />
      <include pattern="ddl.gen" />
      <include pattern="syslib" />
      <include pattern="test" />
    </pattern>

    <access-rule>
      <message>test dependency violation</message>
      <deny>
        <from pattern="test" />
        <to pattern="farrago" />
        <allow>
          <to pattern="test.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="dt.test.deps">
      <include pattern="test.deps" />
      <include pattern="fennel.calc.deps" />
      <include pattern="fennel.rel.deps" />
      <include pattern="dt.test" />
      <include pattern="defimpl.deps" />
    </pattern>

    <access-rule>
      <message>dt.test dependency violation</message>
      <deny>
        <from pattern="dt.test" />
        <to pattern="farrago" />
        <allow>
          <to pattern="dt.test.deps" />
        </allow>
      </deny>
    </access-rule>

    <pattern name="lu.test.deps">
      <include pattern="test.deps" />
      <include pattern="lu.farrago.deps" />
      <include pattern="lu.test" />
    </pattern>

    <access-rule>
      <message>lu.test dependency violation</message>
      <deny>
        <from pattern="lu.test" />
        <to pattern="farrago" />
        <allow>
          <to pattern="lu.test.deps" />
        </allow>
      </deny>
    </access-rule>

    <!-- catch-all for anything not covered above -->
    <access-rule>
      <message>farrago dependency violation</message>
      <deny>
        <from pattern="farrago">
          <exclude pattern="farrago.explicit"/>
        </from>
        <to pattern="farrago" />
      </deny>
    </access-rule>

    <!-- org.eigenbase must be standalone -->
    <access-rule>
      <message>org.eigenbase dependency violation</message>
      <deny>
        <from pattern="eigenbase"/>
        <to pattern="farrago"/>
      </deny>
    </access-rule>

  </ruleset>
</macker>
