com.partnersoft.codex
Class CodexSection

java.lang.Object
  extended by com.partnersoft.codex.CodexSection
All Implemented Interfaces:
CodexNode

public class CodexSection
extends java.lang.Object
implements CodexNode

A subsection of a codex, occupying a branch in the tree structure similar to a directory in a filesystem. A CodexSection can contain one or more subsections itself, and may also contain one or more CodexDocuments.

Author:
Paul Reavis Copyright 2005 Partner Software, Inc.

Field Summary
protected  ResourceFactory resourceFactory
           
protected  Naming<CodexResource> resources
           
protected  Naming<CodexSection> subsections
           
 
Method Summary
 CodexResource createBlankResource(java.lang.String name)
          Doesn't need a resource factory to create a resource.
 java.io.File createFile()
           
 CodexResource createResource(java.lang.String name)
           
 CodexResource createResource(java.lang.String name, byte[] contents)
           
protected static CodexSection createRoot(Codex codex, ResourceFactory resourceFactory, java.lang.Class... modelClasses)
          Used by Codex to create its root subsection.
 Codex getCodex()
           
 java.lang.String getCodexNodeName()
           
 CodexNode getCodexParent()
           
 CodexResource getCodexResource()
           
 CodexSection getCodexSection()
           
 java.lang.String getDefaultExtension()
           
 java.lang.String getName()
           
protected  CodexSection getOrCreateCodexSubsection(java.lang.String name, ResourceFactory resourceFactory, java.lang.Class... modelClasses)
          Used by CodexManager to add the subsections for a given Codex type.
 CodexSection getParent()
           
 Path getPath()
           
 Naming<CodexResource> getResources()
           
 Naming getSubsections()
           
 Workspace getWorkspace()
           
 java.util.Iterator<CodexResource> iterateResources()
           
 java.util.Iterator<CodexSection> iterator()
           
 void moveSection(java.lang.String newFullPath)
           
protected  void notifyMove(java.lang.String newFullPath)
           
protected  void notifyRemoveResource(CodexResource resource)
           
 CodexResource resourceAt(Path path)
           
 CodexResource resourceAt(java.lang.String path)
           
 CodexSection sectionAt(Path path)
           
 CodexSection sectionAt(java.lang.String path)
           
 CodexSection subsectionNamed(java.lang.String name)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resourceFactory

protected ResourceFactory resourceFactory

resources

protected Naming<CodexResource> resources

subsections

protected Naming<CodexSection> subsections
Method Detail

createFile

public java.io.File createFile()

notifyRemoveResource

protected void notifyRemoveResource(CodexResource resource)

notifyMove

protected void notifyMove(java.lang.String newFullPath)

createBlankResource

public CodexResource createBlankResource(java.lang.String name)
                                  throws java.io.IOException
Doesn't need a resource factory to create a resource. Just creates a blank, uneditable (by Codex) resource. Specifically to support the hack of creating fonts.packrat and textures.packrat.

Parameters:
name -
Returns:
Throws:
java.io.IOException

createResource

public CodexResource createResource(java.lang.String name)
                             throws java.io.IOException
Throws:
java.io.IOException

createResource

public CodexResource createResource(java.lang.String name,
                                    byte[] contents)
                             throws java.io.IOException
Throws:
java.io.IOException

getCodexParent

public CodexNode getCodexParent()
Specified by:
getCodexParent in interface CodexNode

getDefaultExtension

public java.lang.String getDefaultExtension()

getPath

public Path getPath()

iterateResources

public java.util.Iterator<CodexResource> iterateResources()

iterator

public java.util.Iterator<CodexSection> iterator()

moveSection

public void moveSection(java.lang.String newFullPath)
                 throws java.io.IOException
Throws:
java.io.IOException

resourceAt

public CodexResource resourceAt(java.lang.String path)

resourceAt

public CodexResource resourceAt(Path path)

sectionAt

public CodexSection sectionAt(java.lang.String path)

sectionAt

public CodexSection sectionAt(Path path)

subsectionNamed

public CodexSection subsectionNamed(java.lang.String name)

getWorkspace

public Workspace getWorkspace()
Specified by:
getWorkspace in interface CodexNode

getCodex

public Codex getCodex()
Specified by:
getCodex in interface CodexNode

getCodexSection

public CodexSection getCodexSection()
Specified by:
getCodexSection in interface CodexNode

getCodexResource

public CodexResource getCodexResource()
Specified by:
getCodexResource in interface CodexNode

getName

public java.lang.String getName()

getCodexNodeName

public java.lang.String getCodexNodeName()
Specified by:
getCodexNodeName in interface CodexNode

getParent

public CodexSection getParent()

getResources

public Naming<CodexResource> getResources()

getSubsections

public Naming getSubsections()

createRoot

protected static CodexSection createRoot(Codex codex,
                                         ResourceFactory resourceFactory,
                                         java.lang.Class... modelClasses)
                                  throws java.io.IOException
Used by Codex to create its root subsection.

Returns:
Throws:
java.io.IOException

getOrCreateCodexSubsection

protected CodexSection getOrCreateCodexSubsection(java.lang.String name,
                                                  ResourceFactory resourceFactory,
                                                  java.lang.Class... modelClasses)
                                           throws java.io.IOException
Used by CodexManager to add the subsections for a given Codex type. Not the best name, but getOrCreateCodexSubsection was

Parameters:
name -
Returns:
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object