From: Julio G. <ju...@us...> - 2006-02-21 01:34:04
|
Update of /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5235/smartfrog/src/org/smartfrog/sfcore/logging Modified Files: components.sf LogToPrim.java LogToPrimImpl.java logtoprimimpl.sf LogToStreams.java LogToStreamsImpl.java SFLogImpl.java SFLogStdStreamImpl.java Log Message: Minor updates Index: LogToPrim.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToPrim.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LogToPrim.java 20 Feb 2006 19:09:33 -0000 1.3 --- LogToPrim.java 21 Feb 2006 01:33:50 -0000 1.4 *************** *** 1,3 **** ! /** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or --- 1,3 ---- ! /** (C) Copyright 1998-2006 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or Index: logtoprimimpl.sf =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/logtoprimimpl.sf,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** logtoprimimpl.sf 20 Feb 2006 19:09:33 -0000 1.4 --- logtoprimimpl.sf 21 Feb 2006 01:33:50 -0000 1.5 *************** *** 1,3 **** ! /** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or --- 1,3 ---- ! /** (C) Copyright 1998-2006 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or Index: LogToStreamsImpl.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToStreamsImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LogToStreamsImpl.java 15 Feb 2006 17:24:35 -0000 1.9 --- LogToStreamsImpl.java 21 Feb 2006 01:33:50 -0000 1.10 *************** *** 1,4 **** /* ! * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2001-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); Index: LogToStreams.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToStreams.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogToStreams.java 23 Jun 2005 13:12:37 -0000 1.2 --- LogToStreams.java 21 Feb 2006 01:33:50 -0000 1.3 *************** *** 1,3 **** ! /** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or --- 1,3 ---- ! /** (C) Copyright 1998-2006 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or *************** *** 17,21 **** For more information: www.smartfrog.org ! */ package org.smartfrog.sfcore.logging; --- 17,21 ---- For more information: www.smartfrog.org ! */ package org.smartfrog.sfcore.logging; Index: LogToPrimImpl.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/LogToPrimImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LogToPrimImpl.java 20 Feb 2006 19:09:33 -0000 1.5 --- LogToPrimImpl.java 21 Feb 2006 01:33:50 -0000 1.6 *************** *** 1,3 **** ! /** (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or --- 1,3 ---- ! /** (C) Copyright 1998-2006 Hewlett-Packard Development Company, LP This library is free software; you can redistribute it and/or *************** *** 24,38 **** import org.smartfrog.sfcore.common.SmartFrogException; - import java.io.PrintStream; import org.smartfrog.sfcore.componentdescription.ComponentDescription; import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.common.SmartFrogResolutionException; import java.rmi.*; - import java.io.BufferedReader; - import java.io.InputStream; - import java.io.IOException; - import java.io.InputStreamReader; - import java.io.PipedOutputStream; - import java.io.PipedInputStream; import org.smartfrog.sfcore.processcompound.ProcessCompound; import org.smartfrog.sfcore.common.Logger; --- 24,31 ---- Index: SFLogImpl.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/SFLogImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SFLogImpl.java 17 Feb 2006 18:28:27 -0000 1.2 --- SFLogImpl.java 21 Feb 2006 01:33:50 -0000 1.3 *************** *** 32,39 **** import org.smartfrog.sfcore.componentdescription.ComponentDescription; import org.smartfrog.sfcore.common.SmartFrogCoreKeys; - /** - * This class has to be run through RMIC compiler (add it to RMITARGETS) - */ public class SFLogImpl extends PrimImpl implements Prim, SFLog, Log { --- 32,37 ---- import org.smartfrog.sfcore.componentdescription.ComponentDescription; import org.smartfrog.sfcore.common.SmartFrogCoreKeys; + import org.smartfrog.sfcore.common.*; public class SFLogImpl extends PrimImpl implements Prim, SFLog, Log { *************** *** 60,64 **** * @exception SmartFrogException In case of error in deploying * @exception RemoteException In case of network/rmi error ! */ public synchronized void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); --- 58,62 ---- * @exception SmartFrogException In case of error in deploying * @exception RemoteException In case of network/rmi error ! */ public synchronized void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); *************** *** 82,85 **** --- 80,90 ---- public synchronized void sfTerminateWith(TerminationRecord t) { if (sfLog().isDebugEnabled()) sfLog().debug(" Terminating for reason: " + t.toString()); + if (logFrom != null) { + try { + logFrom.deregister(logName); + } catch (Exception ex) { + if (sfLog().isErrorEnabled()) sfLog().error("Deregistration failed for: " + logName,ex); + } + } super.sfTerminateWith(t); } *************** *** 98,102 **** Prim prim = null; logToCD = sfResolve(ATR_LOG_TO, logToCD , false);// Get a logger from a component. if it does not exists use sfLog() - logFrom = (LogRegistration)sfResolve(ATR_LOG_FROM, logFrom, false);// Register with Log if exists, if not listen only. logName = sfResolve(ATR_LOG_NAME, sfCompleteName().toString() , false); logLevel = sfResolve (ATR_LOG_LEVEL, logLevel , false); --- 103,106 ---- *************** *** 107,110 **** --- 111,130 ---- logTo.trace("logTo ready."); } + + //Try to get a Prim implementing LogResgistration and if not, then get sfLog() from targeted PrimImpl. + Prim logFromPrim = (Prim)sfResolve(ATR_LOG_FROM, logFrom, false);// Register with Log if exists, if not listen only. + if (logFromPrim !=null) { + if (logFromPrim instanceof LogRegistration) { + logFrom = (LogRegistration) logFromPrim; + } else{ + LogSF logsf = ((PrimImpl) logFromPrim).sfLog(); + if (logsf instanceof LogRegistration) { + logFrom = (LogRegistration)logsf; + } + } + if (logFrom == null){ + throw new SmartFrogResolutionException("'logFrom' not found for "+logFromPrim+" ["+logFromPrim.getClass().getName()+"]"); + } + } } Index: components.sf =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/components.sf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** components.sf 20 Feb 2006 19:09:33 -0000 1.2 --- components.sf 21 Feb 2006 01:33:50 -0000 1.3 *************** *** 52,53 **** --- 52,60 ---- logStdErrLevel "error"; } + + + SFLogRegistration extends Prim { + sfClass "org.smartfrog.sfcore.logging.SFLogRegistrationImpl"; + + //log; //-> Optional: bind to log name using LogFactory or Prim log when nothing is defined. + } Index: SFLogStdStreamImpl.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/logging/SFLogStdStreamImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SFLogStdStreamImpl.java 20 Feb 2006 19:08:37 -0000 1.1 --- SFLogStdStreamImpl.java 21 Feb 2006 01:33:50 -0000 1.2 *************** *** 38,44 **** import java.lang.reflect.Method; - /** - * This class has to be run through RMIC compiler (add it to RMITARGETS) - */ public class SFLogStdStreamImpl extends PrimImpl implements Prim, SFLogStdStream { --- 38,41 ---- |