Mail Archive Home | gotm-commits List | May 2005 Index
| Date Index --> | Thread Index --> |
Date: Monday, May 23, 2005 @ 13:20:52
Author: rouvoy
Path: /cvsroot/gotm/fractal-template/src/java/org/objectweb/fractal/lib
Modified: BindablePrimitive.java LoggablePrimitive.java package.html
* Logging improved,
* Performance improved,
* Cosmetic Updates.
------------------------+
BindablePrimitive.java | 46 +++++++++++++++++++++-----------------
LoggablePrimitive.java | 56 +++++++++++++++++++++++------------------------
package.html | 11 +++++----
3 files changed, 61 insertions(+), 52 deletions(-)
Index:
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java
diff -u
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java:1.5
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java:1.6
---
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java:1.5
Wed Jan 5 16:57:38 2005
+++
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java
Mon May 23 13:20:52 2005
@@ -23,12 +23,13 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: BindablePrimitive.java,v 1.5 2005/01/05 15:57:38 rouvoy Exp $
+ $Id: BindablePrimitive.java,v 1.6 2005/05/23 11:20:52 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.lib;
-import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Map;
+import java.util.Set;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.BindingController;
@@ -39,23 +40,23 @@
* Client interfaces are now retrieved via the
* <code>Object lookFc(String)</code> method.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @fractal.itf
*/
public abstract class BindablePrimitive
extends LoggablePrimitive
implements BindingController
{
- /** the list of bindings. */
- private final Map fcBindings = new HashMap();
+ /** Fractal ADL Identifier for the <code>Component</code> interface. */
+ public static final String COMPONENT = "component";
- /**
- * Provides access to the binding list.
- * @return Returns the fcBindings.
- */
- private Map getFcBindings() {
- return this.fcBindings;
- }
+ /** list of private interfaces registered. */
+ private static final String[] privateFc =
{COMPONENT,LOGGER,LOGGER_FACTORY};
+ /** list of public interfaces registered. */
+ private final String[] publicFc = clientFc();
+
+ /** the list of bindings. */
+ protected final Map fcBindings = new Hashtable();
/**
* Checks if the interface name is allowed to be binded.
@@ -63,13 +64,17 @@
* @return the name of the allowed interface.
* @throws NoSuchInterfaceException if the interface is unknown.
*/
- private String checkBinding(String name)
+ private final String checkBinding(final String name)
throws NoSuchInterfaceException
{
- String[] list = clientFc();
- for (int i=0 ; i < list.length ; i++)
- if (name.startsWith(list[i]))
+ for (int i=0 ; i < publicFc.length ; i++)
+ if (name.startsWith(publicFc[i]))
+ return name ;
+ for (int i=0 ; i < privateFc.length ; i++)
+ if (name.startsWith(privateFc[i]))
return name ;
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(ERROR, "Interface "+name+" not registered");
throw new NoSuchInterfaceException(name);
}
@@ -83,7 +88,8 @@
* @see org.objectweb.fractal.api.control.BindingController#listFc()
*/
public String[] listFc() {
- return (String[]) getFcBindings().keySet().toArray(new String[0]);
+ Set fc = this.fcBindings.keySet();
+ return (String[]) fc.toArray(new String[fc.size()]);
}
/* (non-Javadoc)
@@ -92,7 +98,7 @@
public Object lookupFc(String arg0)
throws NoSuchInterfaceException
{
- return getFcBindings().get(checkBinding(arg0));
+ return this.fcBindings.get(checkBinding(arg0));
}
/* (non-Javadoc)
@@ -101,7 +107,7 @@
public void bindFc(String arg0, Object arg1)
throws NoSuchInterfaceException
{
- getFcBindings().put(checkBinding(arg0),arg1);
+ this.fcBindings.put(checkBinding(arg0),arg1);
}
/* (non-Javadoc)
@@ -110,6 +116,6 @@
public void unbindFc(String arg0)
throws NoSuchInterfaceException
{
- getFcBindings().remove(checkBinding(arg0));
+ this.fcBindings.remove(checkBinding(arg0));
}
}
Index:
fractal-template/src/java/org/objectweb/fractal/lib/LoggablePrimitive.java
diff -u
fractal-template/src/java/org/objectweb/fractal/lib/LoggablePrimitive.java:1.6
fractal-template/src/java/org/objectweb/fractal/lib/LoggablePrimitive.java:1.7
---
fractal-template/src/java/org/objectweb/fractal/lib/LoggablePrimitive.java:1.6
Mon Jan 10 17:11:42 2005
+++
fractal-template/src/java/org/objectweb/fractal/lib/LoggablePrimitive.java
Mon May 23 13:20:52 2005
@@ -23,71 +23,71 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: LoggablePrimitive.java,v 1.6 2005/01/10 16:11:42 rouvoy Exp $
+ $Id: LoggablePrimitive.java,v 1.7 2005/05/23 11:20:52 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.lib;
+import org.objectweb.util.monolog.api.BasicLevel;
import org.objectweb.util.monolog.api.Loggable;
import org.objectweb.util.monolog.api.Logger;
import org.objectweb.util.monolog.api.LoggerFactory;
-import org.objectweb.util.trace.TraceTemplate;
/**
* Implementation of a Fractal component supporting Monolog logging
framework.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.6 $
- * @fractal.itf name="logger"
signature="org.objectweb.util.monolog.api.Loggable"
+ * @version $Revision: 1.7 $
+ * @fractal.itf name="loggable"
signature="org.objectweb.util.monolog.api.Loggable"
*/
public abstract class LoggablePrimitive
+extends BasicLevel
implements Loggable
{
+ /** Fractal ADL Identifier for the <code>Logger</code> interface. */
+ public static final String LOGGER = "logger";
+
+ /** Fractal ADL Identifier for the <code>LoggerFactory</code> interface.
*/
+ public static final String LOGGER_FACTORY = "monolog-factory";
+
/** Log wrapper. */
- private TraceTemplate trace;
+ private Logger logger;
/** LoggerFactory. */
- private LoggerFactory factory;
-
- /**
- * Provides the trace object used to log the current component.
- * @return Returns the trace.
- */
- protected TraceTemplate getTrace() {
- return this.trace;
- }
-
- /**
- * Defines the trace object used to log the current component.
- * @param trace The trace to set.
- */
- protected void setTrace(TraceTemplate trace) {
- this.trace = trace;
- }
+ private LoggerFactory loggerFactory;
/* (non-Javadoc)
* @see org.objectweb.util.monolog.api.Loggable#getLogger()
*/
public Logger getLogger() {
- return getTrace().getLogger();
+ return this.logger;
}
+ /**
+ * Retrieves the logger instance used identified by the name argument.
+ * @param name the identifier of the logger to use.
+ * @return the associated logger.
+ */
+ public Logger getLogger(final String name) {
+ return this.loggerFactory.getLogger(name);
+ }
+
/* (non-Javadoc)
* @see
org.objectweb.util.monolog.api.Loggable#setLogger(org.objectweb.util.monolog.api.Logger)
*/
- public void setLogger(Logger log) {
- setTrace(new TraceTemplate(log));
+ public void setLogger(final Logger log) {
+ this.logger = log;
}
/* (non-Javadoc)
* @see org.objectweb.util.monolog.api.Loggable#getLoggerFactory()
*/
public LoggerFactory getLoggerFactory() {
- return this.factory;
+ return this.loggerFactory;
}
/* (non-Javadoc)
* @see
org.objectweb.util.monolog.api.Loggable#setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory)
*/
- public void setLoggerFactory(LoggerFactory arg0) {
- this.factory = arg0;
+ public void setLoggerFactory(final LoggerFactory arg0) {
+ this.loggerFactory = arg0;
}
}
Index: fractal-template/src/java/org/objectweb/fractal/lib/package.html
diff -u fractal-template/src/java/org/objectweb/fractal/lib/package.html:1.1
fractal-template/src/java/org/objectweb/fractal/lib/package.html:1.2
--- fractal-template/src/java/org/objectweb/fractal/lib/package.html:1.1
Tue Dec 14 09:58:44 2004
+++ fractal-template/src/java/org/objectweb/fractal/lib/package.html Mon
May 23 13:20:52 2005
@@ -15,15 +15,18 @@
<!-- USA -->
<!-- Initial developer(s): Romain Rouvoy. -->
<!-- Contributor(s): ______________________________________. -->
-<!-- $Id: package.html,v 1.1 2004/12/14 08:58:44 rouvoy Exp $ -->
+<!-- $Id: package.html,v 1.2 2005/05/23 11:20:52 rouvoy Exp $ -->
<!-- ==================================================================== -->
<html>
<head>
<title>Fractal Library.</title>
</head>
<body>
- <p> Basic Library for the development of Fractal Applications. </p>
- <p> This part includes only the basic interfaces which would be reused
by
- the differents modules of the Transaction Working Group. </p>
+ <p> Basic Library for the development of <a
+ href="http://fractal.objectweb.org">Fractal</a> Applications. </p>
+ <p> This package includes several abstract implementation of Fractal
+ components providing facilities for logging (via the <a
+ href="http://monolog.objectweb.org">Monolog framework</a>) and
managing
+ the bindings (via the Fractal Binding controller). </p>
</body>
</html>
| Date Index --> | Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.