/*
 * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.orientechnologies.orient.core.metadata.schema;

import java.util.Collection;
import java.util.Set;

import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.storage.OStorage;
import com.orientechnologies.orient.core.type.ODocumentWrapper;

public interface OSchema {

  public int countClasses();

  public OClass createClass(final Class<?> iClass);

  public OClass createClass(final Class<?> iClass, final int iDefaultClusterId);

  public OClass createClass(final String iClassName);

  public OClass createClass(final String iClassName, final OClass iSuperClass);

  public OClass createClass(final String iClassName, final OClass iSuperClass, final OStorage.CLUSTER_TYPE iType);

  public OClass createClass(final String iClassName, final int iDefaultClusterId);

  public OClass createClass(final String iClassName, final OClass iSuperClass, final int iDefaultClusterId);

  public OClass createClass(final String iClassName, final OClass iSuperClass, final int[] iClusterIds);

  public OClass createAbstractClass(final Class<?> iClass);

  public OClass createAbstractClass(final String iClassName);

  public OClass createAbstractClass(final String iClassName, final OClass iSuperClass);

  public void dropClass(final String iClassName);

  public <RET extends ODocumentWrapper> RET reload();

  public boolean existsClass(final String iClassName);

  public OClass getClass(final Class<?> iClass);

  /**
   * Returns the OClass instance by class name. If the class is not configured and the database has an entity manager with the
   * requested class as registered, then creates a schema class for it at the fly.
   * 
   * @param iClassName
   *          Name of the class to retrieve
   * @return
   */
  public OClass getClass(final String iClassName);

  public OClass getOrCreateClass(final String iClassName);
  
  public OClass getOrCreateClass(final String iClassName, final OClass iSuperClass);

  public Collection<OClass> getClasses();

  public void create();

	@Deprecated
  public int getVersion();

  public ORID getIdentity();

  /**
   * Do nothing. Starting from 1.0rc2 the schema is auto saved!
   * 
   * @COMPATIBILITY 1.0rc1
   */
  public <RET extends ODocumentWrapper> RET save();

  /**
   * Returns all the classes that rely on a cluster
   * 
   * @param name
   *          Cluster name
   */
  public Set<OClass> getClassesRelyOnCluster(String iClusterName);
}
@@ -2201,16 +2201,29 @@
 ss name.
+%0D%0A   * %0D%0A   *
  If the 
@@ -2293,22 +2293,16 @@
 with the
-%0D%0A   *
  request
@@ -2339,16 +2339,22 @@
 reates a
+%0D%0A   *
  schema 
@@ -2378,32 +2378,145 @@
 he fly.%0D%0A   * %0D%0A
+   * If the database nor the entity manager have not registered class with specified name, returns null.%0D%0A   * %0D%0A
    * @param iCla
@@ -2580,16 +2580,83 @@
  @return
+ class instance or null if class with given name is not configured.
 %0D%0A   */%0D
@@ -2770,18 +2770,16 @@
 Name);%0D%0A
-  
 %0D%0A  publ
@@ -2936,9 +2936,10 @@
 %0D%0A%0D%0A
-%09
+  
 @Dep
@@ -3367,8 +3367,10 @@
 ame);%0D%0A%7D
+%0D%0A

improve java doc