1 package org.jerpa.component.demo; 2 3 8 9 import org.jerpa.component.*; 10 import org.jerpa.component.configuration.*; 11 import org.jerpa.component.logger.*; 12 import org.jerpa.util.*; 13 14 public class DemoComponent extends Component 15 implements Serviceable 16 { 17 LoggerComponent logger = null; 18 19 public DemoComponent() 20 { 21 setName("Demo Component"); 22 setRole("org.jerpa.component.demo.DemoComponent"); 23 setDesc("This is a sample component."); 24 setAuthor("Michael Kleinhenz"); 25 setCopyright("The JERPA Team. This is GNU Software."); 26 setVersion(new Version(0,0,1)); 27 setServiceable(new Boolean (true)); 28 29 configuration.addStringItem(new StringConfigurationItem("stringKey","StringValue")); 31 configuration.addIntegerItem(new IntegerConfigurationItem("integerKey",new Integer (40))); 32 }; 33 34 public void init(ComponentManager _manager) 35 { 36 componentManager = _manager; 37 try 40 { 41 logger = (LoggerComponent)componentManager.lookup("org.jerpa.component.Logger"); 42 org.jerpa.component.api.SQLConnector db = (org.jerpa.component.api.SQLConnector)componentManager.lookup("org.jerpa.component.SQLConnector"); 43 db.query("Hallo Welt"); 44 } 45 catch (ComponentException e) 46 { 47 System.out.println(e.getMessage()); 48 }; 49 logger.log(this,"Init called."); 51 }; 52 53 public void finalize() 54 { 55 logger.log(this,"Finalize called."); 57 }; 58 59 public Configuration getConfiguration() 60 { 61 return configuration; 62 }; 63 64 public Response service(Request query) 65 throws ComponentException 66 { 67 logger.log(this,"Service called."); 68 return null; 69 }; 70 }; 71 72 | Popular Tags |