/*
 * ModeShape (http://www.modeshape.org)
 * See the COPYRIGHT.txt file distributed with this work for information
 * regarding copyright ownership.  Some portions may be licensed
 * to Red Hat, Inc. under one or more contributor license agreements.
 * See the AUTHORS.txt file in the distribution for a full listing of 
 * individual contributors. 
 *
 * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
 * is licensed to you under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * ModeShape 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
 
//------------------------------------------------------------------------------
// N A M E S P A C E S
//------------------------------------------------------------------------------

<nt  = "http://www.jcp.org/jcr/nt/1.0">
<xmi = "http://www.omg.org/XMI">
<vdb = "http://www.metamatrix.com/metamodels/VirtualDatabase">
<mmcore = "http://www.metamatrix.com/metamodels/Core">
<mode = "http://www.modeshape.org/1.0">

//------------------------------------------------------------------------------
// N O D E T Y P E S
//------------------------------------------------------------------------------

[vdb:virtualDatabase] > nt:unstructured, mode:hashed
 - vdb:description (string) 
 - vdb:version (long) = '1' autocreated
 - vdb:preview (boolean) = 'false' autocreated
 - vdb:originalFile (string) mandatory
 + vdb:translators (vdb:translators) copy
 + vdb:dataRoles (vdb:dataRoles) copy
 + vdb:entries (vdb:entries) copy
 + vdb:importVdbs (vdb:importVdbs) copy

[vdb:abstractModel] mixin
 - vdb:description (string)
 - vdb:visible (boolean) = 'true' autocreated
 - vdb:pathInVdb (string)
 - vdb:sourceTranslator (string)
 - vdb:sourceJndiName (string)
 - vdb:sourceName (string)

// name is the node name (xmi models)
[vdb:model] > vdb:abstractModel, mmcore:model
 - vdb:checksum (long)
 - vdb:builtIn (boolean) = 'false' autocreated
 + vdb:markers (vdb:markers) = vdb:markers copy

// model name is the node name
[vdb:declarativeModel] > nt:unstructured, vdb:abstractModel, mix:referenceable
 - mmcore:modelType (string) = 'PHYSICAL' autocreated < 'PHYSICAL','VIRTUAL'
 - vdb:metadataType (string) = 'DDL' autocreated
 - vdb:modelDefinition (string)

[vdb:markers] > nt:unstructured
 + vdb:marker (vdb:marker) = vdb:marker copy sns

[vdb:marker] > nt:unstructured
 - vdb:severity (string) = 'WARNING' autocreated < 'WARNING','ERROR','INFO'
 - vdb:path (string) mandatory
 - vdb:message (string) mandatory
 
[vdb:translators] > nt:unstructured
 + vdb:translator (vdb:translator) copy
 
 // translator name is node name
[vdb:translator] > nt:unstructured
 - vdb:type (string) mandatory
 - vdb:description (string)
 
[vdb:dataRoles] > nt:unstructured
 + vdb:dataRole (vdb:dataRole) copy

// data role name is node name 
[vdb:dataRole] > nt:unstructured
 - vdb:description (string)
 - vdb:anyAuthenticated (boolean) = 'false' autocreated
 - vdb:allowCreateTemporaryTables (boolean) = 'false' autocreated
 - vdb:mappedRoleNames (string) multiple
 + vdb:permission (vdb:permission) = vdb:permission multiple copy

[vdb:entries] > nt:unstructured
 + vdb:vdbEntry (vdb:entry) copy sns
 
[vdb:entry] > nt:unstructured
 - vdb:path (string) mandatory
 - vdb:description (string)

[vdb:permissions] > nt:unstructured
 + vdb:permission (vdb:permission) copy

// permission resource path is node path
[vdb:permission] > nt:unstructured
 - vdb:allowCreate (boolean) = 'false' autocreated
 - vdb:allowRead (boolean) = 'false' autocreated
 - vdb:allowUpdate (boolean) = 'false' autocreated
 - vdb:allowDelete (boolean) = 'false' autocreated
 - vdb:allowExecute (boolean) = 'false' autocreated
 - vdb:allowAlter (boolean) = 'false' autocreated

// group node for the VDBs that are imported by a VDB
[vdb:importVdbs] > nt:unstructured
 + vdb:importVdb (vdb:importVdb) copy
 
// imported VDB name is node path
[vdb:importVdb] > nt:unstructured
 - vdb:version (long) mandatory
 - vdb:importDataPolicies (boolean)= 'true' autocreated
