Author: oberhack Date: Sat Aug 14 08:03:40 2004 New Revision: 36396 Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/Application.java avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/block.xml avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/debug.xml avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationComponent.java avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationComponent.xprofile avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationService.java avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/block.xml avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/PublisherComponent.java avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/PublisherService.java avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/block.xml Log:
Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/Application.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/Application.java Sat Aug 14 08:03:40 2004 @@ -0,0 +1,76 @@ +/* + * Copyright 2004 Apache Software Foundation + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tutorial.application; + +import java.io.File; + +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.service.Serviceable; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.activity.Disposable; + +import tutorial.location.LocationService; +import tutorial.publisher.PublisherService; + +/** + * PublisherComponent from Merlin's Composition Tutorial + * + * @avalon.component version="1.0" name="test" + * @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a> + */ +public class Application extends AbstractLogEnabled implements Serviceable, Disposable +{ + + /** + * Servicing of the component by the container during + * which service dependencies declared under the component + * can be resolved using the supplied service manager. In this + * example the component uses a LocatorService service to log a + * message exposing a location. + * + * @param manager the service manager + * @avalon.dependency key="locator" type="tutorial.location.LocationService" + * @avalon.dependency key="publisher" type="tutorial.publisher.PublisherService" + */ + public void service( ServiceManager manager ) throws ServiceException + { + getLogger().info( "servicing application" ); + + LocationService locator = (LocationService) manager.lookup( "locator" ); + PublisherService publisher = (PublisherService) manager.lookup( "publisher" ); + + // + // get the location from the locator and publish + // it using the publisher + // + + publisher.publish( + "\n******************" + + "\n* " + locator.getLocation() + + "\n******************"); + + getLogger().info( "done" ); + } + + public void dispose() + { + getLogger().info( "disposal" ); + } +} + Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/block.xml ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/block.xml Sat Aug 14 08:03:40 2004 @@ -0,0 +1,23 @@ + +<container name="application"> + + <classloader> + <classpath> + <repository> + <resource id="avalon-framework:avalon-framework-api" version="4.2.0"/> + <resource id="avalon-framework:avalon-framework-impl" version="4.2.0"/> + <resource id="merlin-tutorial:locator-api" version="1.0"/> + <resource id="merlin-tutorial:publisher-api" version="1.0"/> + <resource id="merlin-tutorial:application-impl" version="1.0"/> + </repository> + </classpath> + </classloader> + + <include name="location" id="merlin-tutorial:locator-impl" version="1.0"/> + <include name="publisher" id="merlin-tutorial:publisher-impl" version="1.0"/> + + <component name="application" + class="tutorial.application.Application"> + </component> + +</container> Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/debug.xml ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/application/debug.xml Sat Aug 14 08:03:40 2004 @@ -0,0 +1,14 @@ + +<targets> + + <target path="/application/application"> + <categories priority="DEBUG"/> + </target> + <target path="/application/publisher/publisher"> + <categories priority="DEBUG"/> + </target> + <target path="/application/location/info"> + <categories priority="DEBUG"/> + </target> + +</targets> Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationComponent.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationComponent.java Sat Aug 14 08:03:40 2004 @@ -0,0 +1,69 @@ +/* + * Copyright 2004 Apache Software Foundation + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tutorial.location; + +import java.io.File; + +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.activity.Disposable; + +/** + * HelloComponent from Merlin's Tutorial + * + * @avalon.component version="1.0" name="location-provider" + * @avalon.service type="tutorial.location.LocationService" + * @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a> + */ +public class LocationComponent extends AbstractLogEnabled implements +Configurable, Disposable, LocationService +{ + private String m_location = "unknown"; + + /** + * Configuration of the component by the container. The + * implementation gets a child element named 'source' and + * assigns log the value. + * + * @param config the component configuration + * @exception ConfigurationException if a configuration error occurs + */ + public void configure( Configuration config ) throws + ConfigurationException + { + m_location = config.getChild( "source" ).getValue( "unknown" ); + getLogger().info( "location: " + m_location ); + } + + /** + * Return a location. + * @return a location + */ + public String getLocation() + { + return m_location; + } + + public void dispose() + { + getLogger().info( "disposal" ); + } +} + Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationComponent.xprofile ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationComponent.xprofile Sat Aug 14 08:03:40 2004 @@ -0,0 +1,9 @@ +<?xml version="1.0"?> + +<profiles> + <profile name="locator"> + <configuration> + <source>Paris</source> + </configuration> + </profile> +</profiles> Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationService.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/LocationService.java Sat Aug 14 08:03:40 2004 @@ -0,0 +1,33 @@ +/* + * Copyright 2004 Apache Software Foundation + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tutorial.location; + +/** + * LocationService from Merlin's Composition Tutorial + * + * @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a> + */ +public interface LocationService +{ + /** + * Return a location. + * @return a location + */ + public String getLocation(); +} + Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/block.xml ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/location/block.xml Sat Aug 14 08:03:40 2004 @@ -0,0 +1,28 @@ + +<container name="locator"> + + <services> + <service type="tutorial.location.LocationService"> + <source>info</source> + </service> + </services> + + <classloader> + <classpath> + <repository> + <resource id="avalon-framework:avalon-framework-api" version="4.2.0"/> + <resource id="avalon-framework:avalon-framework-impl" version="4.2.0"/> + <resource id="merlin-tutorial:locator-api" version="1.0"/> + <resource id="merlin-tutorial:locator-impl" version="1.0"/> + </repository> + </classpath> + </classloader> + + <component name="info" + class="tutorial.location.LocationComponent"> + <configuration> + <source>Paris</source> + </configuration> + </component> + +</container> Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/PublisherComponent.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/PublisherComponent.java Sat Aug 14 08:03:40 2004 @@ -0,0 +1,63 @@ +/* + * Copyright 2004 Apache Software Foundation + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tutorial.publisher; + +import java.io.File; + +import org.apache.avalon.framework.logger.Logger; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.service.Serviceable; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.activity.Disposable; + +/** + * PublisherComponent from Merlin's Composition Tutorial + * + * @avalon.component version="1.0" name="publisher" + * @avalon.service type="tutorial.publisher.PublisherService" + * @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a> + */ +public class PublisherComponent extends AbstractLogEnabled implements PublisherService, Disposable +{ + /** + * Supply of the logging channel by the container. + * @param logger the logging channel + */ + public void enableLogging( Logger logger ) + { + logger.info( "created" ); + super.enableLogging( logger ); + } + + /** + * Publish a message. + * @param message the message to publish + */ + public void publish( String message ) + { + getLogger().info( message ); + } + + public void dispose() + { + getLogger().info( "disposal" ); + } + +} + Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/PublisherService.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/PublisherService.java Sat Aug 14 08:03:40 2004 @@ -0,0 +1,33 @@ +/* + * Copyright 2004 Apache Software Foundation + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tutorial.publisher; + +/** + * HelloComponent from Merlin's Tutorial + * + * @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a> + */ +public interface PublisherService +{ + /** + * Publish a message. + * @param message the message to publish + */ + public void publish( String message ); +} + Added: avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/block.xml ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/core/templates/composition/publisher/block.xml Sat Aug 14 08:03:40 2004 @@ -0,0 +1,24 @@ + +<container name="publisher-block"> + + <services> + <service type="tutorial.publisher.PublisherService"> + <source>publisher</source> + </service> + </services> + + <classloader> + <classpath> + <repository> + <resource id="avalon-framework:avalon-framework-api" version="4.2.0"/> + <resource id="avalon-framework:avalon-framework-impl" version="4.2.0"/> + <resource id="merlin-tutorial:publisher-api" version="1.0"/> + <resource id="merlin-tutorial:publisher-impl" version="1.0"/> + </repository> + </classpath> + </classloader> + + <component name="publisher" + class="tutorial.publisher.PublisherComponent"/> + +</container> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]