View Javadoc
1 /* 2 * Copyright (c) 2003 3 * Information Desire GmbH 4 * All rights reserved. 5 */ 6 package com.infodesire.infobit.external.impl; 7 8 import com.infodesire.infobit.InfobitException; 9 import com.infodesire.infobit.InfobitSecurityException; 10 11 import com.infodesire.infobit.data.Infobit; 12 13 import org.apache.commons.logging.Log; 14 import org.apache.commons.logging.LogFactory; 15 16 import java.util.Collection; 17 import java.util.HashSet; 18 19 /*** 20 * This class represents an infobit in the dependency graph of content and 21 * nodes. 22 * 23 * @author peter2 24 * @created 1. September 2003 25 * @version $Revision: 1.1 $ 26 */ 27 class InfobitNode extends BufferNode { 28 29 private final static Log _log = LogFactory.getLog(InfobitNode.class); 30 31 /*** 32 * The resolved infobit represented by the present buffer node 33 */ 34 private Infobit _infobit; 35 36 /*** 37 * The name identifying the represented infobit 38 */ 39 private String _name; 40 41 /*** 42 * The infobit reference has not (yet) been resolved. 43 */ 44 private boolean _dangling; 45 46 /*** 47 * The referred infobit has already been detected in the system. 48 */ 49 private boolean _predefined; 50 51 52 /*** 53 * Gets the name to which the infobit is registered. 54 * 55 * @return The Name value 56 */ 57 String getName() { 58 return _name; 59 } 60 61 62 /*** 63 * Gets the Dependencies attribute of the InfobitNode object 64 * 65 * @return The Dependencies value 66 */ 67 Collection getDependencies() { 68 return new HashSet(); 69 } 70 71 72 /*** 73 * The infobit reference has not yet been resolved to a predifined or 74 * imported infobit. 75 * 76 * @return The Dangling value 77 */ 78 boolean isDangling() { 79 return _dangling; 80 } 81 82 83 /*** 84 * The infobit node is per-existent in the system (as opposed to imported). 85 * Defined after {@link #persistBuffer}. 86 * 87 * @return The Predefined value 88 */ 89 boolean isPredefined() { 90 return _predefined; 91 } 92 93 94 /*** 95 * Marks the node as {@link #isPredefined predefined}. 96 * 97 * @param predefined The new Predefined value 98 */ 99 void setPredefined(boolean predefined) { 100 _predefined = predefined; 101 } 102 103 104 /*** 105 * Defines the name to which the infobit is registered. For use on 106 * initialization only. 107 * 108 * @param name The new Name value 109 */ 110 void setName(String name) { 111 _name = name; 112 } 113 114 115 /*** 116 * Marks the infobit as {@link _isDangling dangling}. 117 * 118 * @param dangling The infobit is dangling 119 */ 120 void setDangling(boolean dangling) { 121 _dangling = dangling; 122 } 123 124 125 /*** 126 * This node cannot have dependencies. 127 * 128 * @param dependency Description of Parameter 129 * @param value Description of Parameter 130 */ 131 void resolveDependency(BufferNode dependency, Object value) { 132 _log.error("unknown dependency "); 133 throw new RuntimeException("unknown dependency"); 134 } 135 136 137 /*** 138 * Creates the infobit unless it has already been created. 139 * 140 * @return The infobit represented by the node 141 * @exception InfobitException Description of Exception 142 * @exception InfobitSecurityException Description of Exception 143 */ 144 Object persistBuffer() throws InfobitException, InfobitSecurityException { 145 146 _predefined = _manager.hasInfobit(_name); 147 148 if (_predefined) { 149 _infobit = _manager.getInfobit(_name); 150 } 151 else { 152 _infobit = _manager.createInfobit(_name, _acl); 153 } 154 155 return _infobit; 156 } 157 158 }

This page was automatically generated by Maven