Commit ca5af82e authored by Lionel Seinturier's avatar Lionel Seinturier
Browse files

Tagging version 2.2.6.1.

parent f891260d
/***
* Julia: France Telecom's implementation of the Fractal API
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package collection;
import java.util.HashMap;
import java.util.Map;
import org.objectweb.fractal.api.control.BindingController;
public class CImpl implements BindingController {
private Map bindings = new HashMap();
public String[] listFc () {
return (String[])bindings.keySet().toArray(new String[bindings.size()]);
}
public Object lookupFc (String itf) {
return bindings.get(itf);
}
public void bindFc (String itf, Object value) {
if (!itf.equals("component")) {
bindings.put(itf, value);
}
}
public void unbindFc (String itf) {
bindings.remove(itf);
}
}
/***
* Julia: France Telecom's implementation of the Fractal API
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
package collection;
import java.util.Arrays;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.factory.GenericFactory;
import org.objectweb.fractal.api.type.ComponentType;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.api.type.TypeFactory;
import org.objectweb.fractal.util.Fractal;
public class Collection {
public static void main (String[] args) throws Exception {
Component boot = Fractal.getBootstrapComponent();
TypeFactory tf = Fractal.getTypeFactory(boot);
ComponentType aType = tf.createFcType(new InterfaceType[0]);
ComponentType bType = tf.createFcType(new InterfaceType[] {
tf.createFcItfType("client", I.class.getName(), true, true, true)
});
ComponentType sType = tf.createFcType(new InterfaceType[] {
tf.createFcItfType("server", I.class.getName(), false, false, false)
});
GenericFactory cf = Fractal.getGenericFactory(boot);
Component aComp = cf.newFcInstance(aType, "composite", null);
Component bComp = cf.newFcInstance(bType, "autoBindingComposite", null);
Component cComp = cf.newFcInstance(bType, "autoBindingPrimitive", CImpl.class.getName());
Component s1Comp = cf.newFcInstance(sType, "primitive", SImpl.class.getName());
Component s2Comp = cf.newFcInstance(sType, "primitive", SImpl.class.getName());
Component s3Comp = cf.newFcInstance(sType, "primitive", SImpl.class.getName());
Fractal.getContentController(aComp).addFcSubComponent(bComp);
Fractal.getContentController(aComp).addFcSubComponent(s1Comp);
Fractal.getContentController(aComp).addFcSubComponent(s2Comp);
Fractal.getContentController(aComp).addFcSubComponent(s3Comp);
Fractal.getContentController(bComp).addFcSubComponent(cComp);
// creates a binding between b and s1
Fractal.getBindingController(bComp).bindFc(
"client-I", s1Comp.getFcInterface("server"));
// creates a "model" binding between c and b
// this automatically creates similar bindings bewteen c and b,
// for each interface in the collection in b
Fractal.getBindingController(cComp).bindFc(
"client",
Fractal.getContentController(bComp).getFcInternalInterface("client"));
// we can check this with the following code:
String[] itfs = Fractal.getBindingController(cComp).listFc();
System.out.println(Arrays.asList(itfs));
// during the following bindings between b and si,
// similar bindings are created between c and b (following the model binding)
Fractal.getBindingController(bComp).bindFc(
"client-II", s2Comp.getFcInterface("server"));
Fractal.getBindingController(bComp).bindFc(
"client-III", s3Comp.getFcInterface("server"));
// we can check this with the following code:
itfs = Fractal.getBindingController(cComp).listFc();
System.out.println(Arrays.asList(itfs));
// removing bindings between b and si also removes bindings between c and b
Fractal.getBindingController(bComp).unbindFc("client-I");
Fractal.getBindingController(bComp).unbindFc("client-II");
Fractal.getBindingController(bComp).unbindFc("client-III");
itfs = Fractal.getBindingController(cComp).listFc();
System.out.println(Arrays.asList(itfs));
}
}
package collection;
/***
* Julia: France Telecom's implementation of the Fractal API
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
public interface I {
void m ();
}
package collection;
/***
* Julia: France Telecom's implementation of the Fractal API
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
*
* Author: Eric Bruneton
*/
public class SImpl implements I {
public void m () {
}
}
This is the comanche web server. This program was implemented with
Julia and runs, unmodified, with AOKell.
To execute the example type:
ant execute
The available Ant targets are:
compile: compile the example
execute: execute the example
help: display this help message
clean: clean the generated files
See "Developing with Fractal" in the Documentation section of the
Fractal web site <http://fractal.objectweb.org> for a description
of the comanche architecture.
When run, comanche waits for HTTP request on port 8080. A typical
run of the program should return something like:
Comanche HTTP Server ready on port 8080.
Open the <http://localhost:8080/src/gnu.jpg> URL in your favorite
web browser. A well-known head should appear! To stop the server,
type Ctrl-C in the launching shell.
You can add any file you like in the comanche/ directory to have
them served by comanche.
# JVM arguments
run.jvm.parameters -Dfractal.provider=org.objectweb.fractal.aokell.AOKell
# Java class to be launched
run.classname comanchemain.Main
# Application arguments
run.parameters
# Java interfaces used as Fractal interfaces
# This property is only needed when compile-time generation of Fractal
# interfaces is used (fcinterface set to ct)
fcinterface.ct.parameters java.lang.Runnable comanche.Logger comanche.RequestHandler comanche.Scheduler
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.Analyzer" extends="comanche.AnalyzerType">
<content class="comanche.RequestAnalyzer"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.AnalyzerType">
<interface name="a" signature="comanche.RequestHandler" role="server"/>
<interface name="l" signature="comanche.Logger" role="client"/>
<interface name="rh" signature="comanche.RequestHandler" role="client"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.Backend" extends="comanche.BackendType">
<component name="ra" definition="comanche.Analyzer"/>
<component name="rh" definition="comanche.Handler"/>
<component name="l" definition="comanche.Logger"/>
<binding client="this.rh" server="ra.a"/>
<binding client="ra.l" server="l.l"/>
<binding client="ra.rh" server="rh.rh"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.BackendType">
<interface name="rh" signature="comanche.RequestHandler" role="server"/>
</definition>
/***
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
*/
package comanche;
public class BasicLogger implements Logger {
public void log (String msg) { System.out.println(msg); }
}
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.Comanche" extends="comanche.ComancheType">
<component name="fe" definition="comanche.Frontend"/>
<component name="be" definition="comanche.Backend"/>
<binding client="this.r" server="fe.r"/>
<binding client="fe.rh" server="be.rh"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.ComancheType">
<interface name="r" signature="java.lang.Runnable" role="server"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.Dispatcher" extends="comanche.DispatcherType">
<content class="comanche.RequestDispatcher"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.DispatcherType">
<interface name="rh" signature="comanche.RequestHandler" role="server" />
<interface name="h" signature="comanche.RequestHandler" cardinality="collection" role="client"/>
</definition>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN" "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
<!--
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: Eric.Bruneton@rd.francetelecom.com
* Contact: Lionel.Seinturier@lifl.fr
*
* Author: Eric Bruneton
* Author: Lionel Seinturier
-->
<definition name="comanche.ErrorHandler" extends="comanche.BackendType">
<content class="comanche.ErrorRequestHandler"/>
</definition>
/***
* Comanche web server
* Copyright (C) 2001-2002 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.