taylor 2004/02/26 14:50:42 Modified: components/registry/src/java/org/apache/jetspeed/components/portletentity PortletEntityAccessComponentImpl.java portal maven.xml portal/src/java/org/apache/jetspeed/aggregator/impl PortletRendererImpl.java portal/src/java/org/apache/jetspeed/capability/impl CapabilityValveImpl.java portal/src/test/org/apache/jetspeed/capability TestCapability.java portal/src/webapp/WEB-INF/assembly jetspeed.groovy portal/src/webapp/WEB-INF/conf jetspeed.properties portal/src/webapp/WEB-INF/db/hsql Registry.script Added: portal/src/java/org/apache/jetspeed/capability Capabilities.java portal/src/java/org/apache/jetspeed/capability/containers capability-container.groovy portal/src/java/org/apache/jetspeed/capability/impl JetspeedCapabilities.java Removed: portal/src/java/org/apache/jetspeed/capability CapabilityService.java portal/src/java/org/apache/jetspeed/capability/impl CapabilityServiceImpl.java Log: convert Capabilities from fulcrum service to component Revision Changes Path 1.4 +3 -2 jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java Index: PortletEntityAccessComponentImpl.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PortletEntityAccessComponentImpl.java 25 Feb 2004 22:22:04 -0000 1.3 +++ PortletEntityAccessComponentImpl.java 26 Feb 2004 22:50:41 -0000 1.4 @@ -111,10 +111,11 @@ else { PersistenceStore store = getPersistenceStore(); + prepareTransaction(store); + Filter filter = store.newFilter(); filter.addEqualTo("oid", entityId); Object q = store.newQuery(entityClass, filter); - prepareTransaction(store); PortletEntity portletEntity = (PortletEntity) store.getObjectByQuery(q); entityCache.put(entityId, portletEntity); 1.50 +1 -1 jakarta-jetspeed-2/portal/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/maven.xml,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- maven.xml 26 Feb 2004 05:15:41 -0000 1.49 +++ maven.xml 26 Feb 2004 22:50:41 -0000 1.50 @@ -5,7 +5,7 @@ xmlns:maven="jelly:maven"> <!-- Target of maven test:single test --> -<property name='testcase' value='org.apache.jetspeed.pipeline.TestPipeline'/> +<property name='testcase' value='org.apache.jetspeed.capability.TestCapability'/> <!-- ================================================================ --> <!-- Set System properties for junit --> 1.8 +3 -2 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java Index: PortletRendererImpl.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- PortletRendererImpl.java 24 Feb 2004 00:43:23 -0000 1.7 +++ PortletRendererImpl.java 26 Feb 2004 22:50:41 -0000 1.8 @@ -230,7 +230,8 @@ { ObjectID oid = JetspeedObjectID.createFromString(fragment.getId()); PortletEntityAccessComponent entityAccess = (PortletEntityAccessComponent) Jetspeed.getComponentManager().getComponent(PortletEntityAccessComponent.class); - PortletEntity portletEntity = entityAccess.getPortletEntity(oid); + // DST: PortletEntity portletEntity = entityAccess.getPortletEntity(oid); + PortletEntity portletEntity = null; PortletWindow portletWindow = null; if (portletEntity==null) 1.1 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/Capabilities.java Index: Capabilities.java =================================================================== /* * Copyright 2000-2001,2004 The 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 org.apache.jetspeed.capability; import java.util.Collection; import java.util.Iterator; /** * Capabilities Component Interface * * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a> * @version $Id: Capabilities.java,v 1.1 2004/02/26 22:50:41 taylor Exp $ */ public interface Capabilities { /** * Creates a Capability Map with Capabilities, Mimetypes and mediaTypes for the given UserAgentPattern * @param userAgent Agent from the request * @return CapabilityMap populated with Capabilities, Mimetypes and Mediatype * that match the userAgent */ CapabilityMap getCapabilityMap(String userAgent); /** * Obtain an iterator of all existing clients. * @return Returns an iterator for all existing Clients */ Iterator getClients(); /** * Finds a client for a given userAgentPattern * @param userAgent * @return Client that matches agent or null if no match is found * */ Client findClient(String userAgent); /** * Returns a collection of MediaTypes that matches the MimeTypes defined in the mimetype parameter * @param Mimetype * * @return Collection of Mediatypes that matches the mimetypes */ Collection getMediaTypesForMimeTypes(Iterator mimetypes); /** * Clears CapabilityMap cache * TODO: Roger, why is this on the public interface. It seems to be impl specific */ void deleteCapabilityMapCache(); /** * Given a media type string, look up the corresponding media type object. * * @param mediaType The string representation of a media type. * @return The found media type object or if not found, null. */ MediaType getMediaType(String mediaType); /** * Given a Mimetype string lookup the corresponding media type object * @param mimeTypeName to use for lookup * @return MediaTypeEntry that matches the lookup in the MEDIATYPE_TO_MIMETYPE table */ public MediaType getMediaTypeForMimeType(String mimeTypeName); } 1.1 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/containers/capability-container.groovy Index: capability-container.groovy =================================================================== import org.picocontainer.defaults.DefaultPicoContainer import org.picocontainer.ComponentAdapter import org.picocontainer.defaults.ConstructorComponentAdapter import org.picocontainer.Parameter import org.picocontainer.defaults.ConstantParameter import org.picocontainer.defaults.ComponentParameter import org.hsqldb.jdbcDriver import org.apache.jetspeed.components.hsql.HSQLServerComponent import org.apache.jetspeed.components.hsql.HSQLServerComponent import org.apache.jetspeed.components.jndi.JNDIComponent import org.apache.jetspeed.components.jndi.TyrexJNDIComponent import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent import org.apache.jetspeed.components.datasource.DatasourceComponent import org.apache.commons.pool.impl.GenericObjectPool import org.apache.jetspeed.components.persistence.store.ojb.OJBTypeIntializer import org.apache.jetspeed.components.persistence.store.ojb.otm.OTMStoreImpl import org.apache.jetspeed.components.persistence.store.impl.DefaultPersistenceStoreContainer import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer import org.apache.jetspeed.capability.Capabilities import org.apache.jetspeed.capability.impl.JetspeedCapabilities import java.io.File import java.util.Properties // create the root container container = new DefaultPicoContainer() // This is the HSQL engine that holds the test registry if(new File("./test/db/hsql").exists()) { container.registerComponentInstance(new HSQLServerComponent(9001, "sa","","./test/db/hsql/Registry",false, true)) } else { container.registerComponentInstance(new HSQLServerComponent(9001, "sa","","./portal/test/db/hsql/Registry",false, true)) } // This JNDI component helps us publish the datasource Class jndiClass = Class.forName("org.apache.jetspeed.components.jndi.JNDIComponent") Class tyrexJndiClass = Class.forName("org.apache.jetspeed.components.jndi.TyrexJNDIComponent") container.registerComponentImplementation(jndiClass, tyrexJndiClass) // Create a datasource based on the HSQL server we just created Class dsClass = Class.forName("org.apache.jetspeed.components.datasource.DatasourceComponent") container.registerComponentInstance(dsClass, new DBCPDatasourceComponent("sa","", "org.hsqldb.jdbcDriver", "jdbc:hsqldb:hsql://127.0.0.1", 20, 5000, GenericObjectPool.WHEN_EXHAUSTED_GROW, true)) // // Persistence PersistenceContainer pContainer = new DefaultPersistenceStoreContainer(300000, 10000) Class pContainerClass = Class.forName("org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer") // Parameter[] storeParams = new Parameter[] {new ConstantParameter("jetspeed")} Class OTMStoreClass = Class.forName("org.apache.jetspeed.components.persistence.store.ojb.otm.OTMStoreImpl") ComponentAdapter ca = new ConstructorComponentAdapter("jetspeed", OTMStoreClass, new Parameter[] {new ConstantParameter("jetspeed")}) pContainer.registerComponent(ca) container.registerComponentInstance(pContainerClass, pContainer); // // Capabilities // container.registerComponentInstance(Capabilities, new JetspeedCapabilities(pContainer)) return container 1.5 +7 -7 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/impl/CapabilityValveImpl.java Index: CapabilityValveImpl.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/impl/CapabilityValveImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CapabilityValveImpl.java 8 Jan 2004 23:25:12 -0000 1.4 +++ CapabilityValveImpl.java 26 Feb 2004 22:50:41 -0000 1.5 @@ -56,16 +56,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.jetspeed.Jetspeed; import org.apache.jetspeed.pipeline.PipelineException; import org.apache.jetspeed.pipeline.valve.CapabilityValve; import org.apache.jetspeed.pipeline.valve.ValveContext; import org.apache.jetspeed.profiler.rules.ProfilingRule; import org.apache.jetspeed.request.RequestContext; -import org.apache.jetspeed.capability.CapabilityService; +import org.apache.jetspeed.capability.Capabilities; import org.apache.jetspeed.capability.CapabilityMap; import org.apache.jetspeed.capability.MediaType; import org.apache.jetspeed.capability.MimeType; -import org.apache.jetspeed.cps.CommonPortletServices; /** * Invokes the capability mapper in the request pipeline @@ -86,9 +86,9 @@ } - protected CapabilityService getService() + protected Capabilities getComponent() { - return (CapabilityService) CommonPortletServices.getPortalService(CapabilityService.SERVICE_NAME); + return (Capabilities)Jetspeed.getComponentManager().getComponent(Capabilities.class); } public void invoke(RequestContext request, ValveContext context) @@ -100,10 +100,10 @@ String agent = request.getRequest().getHeader("User-Agent"); // Connect to CapabilityService - CapabilityService service = getService(); + Capabilities component = getComponent(); // Get capability map - CapabilityMap cm = service.getCapabilityMap(agent); + CapabilityMap cm = component.getCapabilityMap(agent); if ( cm == null) { 1.1 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/impl/JetspeedCapabilities.java Index: JetspeedCapabilities.java =================================================================== /* * Copyright 2000-2001,2004 The 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 org.apache.jetspeed.capability.impl; import java.util.Collection; import java.util.Iterator; import java.util.Hashtable; import java.util.Properties; import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.jetspeed.capability.Capabilities; import org.apache.jetspeed.capability.CapabilityMap; import org.apache.jetspeed.capability.Client; import org.apache.jetspeed.capability.MediaType; import org.picocontainer.Startable; import org.apache.jetspeed.capability.Capability; import org.apache.jetspeed.capability.MimeType; import org.apache.jetspeed.components.persistence.store.Filter; import org.apache.jetspeed.components.persistence.store.PersistenceStore; import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer; import org.apache.jetspeed.components.persistence.store.Transaction; /** * Jetspeed Capabilities * * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a> * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a> * @version $Id: JetspeedCapabilities.java,v 1.1 2004/02/26 22:50:41 taylor Exp $ */ public class JetspeedCapabilities implements Capabilities, Startable { private PersistenceStoreContainer pContainer; private String storeName = "jetspeed"; private String originalAlias; private static final Log log = LogFactory.getLog(JetspeedCapabilities.class); public static final String DEFAULT_AGENT = "Mozilla/4.0"; public static final String AGENT_XML = "agentxml/1.0"; // Cache for the capability maps Hashtable capabilityMapCache = new Hashtable(); private Collection clients = null; private Class clientClass = ClientImpl.class; private Class capabilityClass = CapabilityImpl.class; private Class mimeTypeClass = MimeTypeImpl.class; private Class mediaTypeClass = MediaTypeImpl.class; public JetspeedCapabilities(PersistenceStoreContainer pContainer) { this.pContainer = pContainer; } /** * Create a JetspeedProfiler with properties. Expected properties are: * * defaultRule = the default profiling rule * anonymousUser = the name of the anonymous user * storeName = The name of the persistence store component to connect to * services.profiler.locator.impl = the pluggable Profile Locator impl * services.profiler.principalRule.impl = the pluggable Principal Rule impl * services.profiler.profilingRule.impl = the pluggable Profiling Rule impl * * @param pContainer The persistence store container * @param properties Properties for this component described above */ public JetspeedCapabilities(PersistenceStoreContainer pContainer, Properties properties) { this.pContainer = pContainer; initModelClasses(properties); } private void initModelClasses(Properties properties) { String modelName = ""; try { if ((modelName = properties.getProperty("client.impl")) != null) { clientClass = Class.forName(modelName); } if ((modelName = properties.getProperty("capability.impl")) != null) { capabilityClass = Class.forName(modelName); } if ((modelName = properties.getProperty("mimetype.impl")) != null) { mimeTypeClass = Class.forName(modelName); } if ((modelName = properties.getProperty("mediatype.impl")) != null) { mediaTypeClass = Class.forName(modelName); } } catch (ClassNotFoundException e) { log.error("Model class not found: " + modelName); } } public void start() { } public void stop() { } /** * @param userAgent Agent from the request * @see org.apache.jetspeed.services.capability.CapabilityService#getCapabilityMap(java.lang.String) */ public CapabilityMap getCapabilityMap(String userAgent) { CapabilityMap map = null; boolean bClientFound = false; if (userAgent == null) { userAgent = DEFAULT_AGENT; } // Check the cache if we have already a capability map for // the given Agent map = (CapabilityMap) capabilityMapCache.get(userAgent); if (map != null) { // Entry found return map; } while (!bClientFound) { Client entry = findClient(userAgent); if (entry == null) { if (userAgent.equals(DEFAULT_AGENT)) { log.error( "CapabilityMap: Default agent not found in Client Registry !"); // Stop searching -- event the default userAgent can't be found bClientFound = true; } else { // Retry with the default Agent if (log.isDebugEnabled()) { log.debug( "CapabilityMap: useragent " + userAgent + "unknown, falling back to default"); } // Use default Client userAgent = DEFAULT_AGENT; } } else { // Found Client entry start populating the capability map. map = new CapabilityMapImpl(); // Add client to CapabilityMap map.setClient(entry); // Add capabilities Iterator capabilities = entry.getCapabilities().iterator(); while (capabilities.hasNext()) { map.addCapability((Capability) capabilities.next()); } Collection mediatypes = getMediaTypesForMimeTypes(entry.getMimetypes().iterator()); // Add Mimetypes to map Iterator mimetypes = entry.getMimetypes().iterator(); while (mimetypes.hasNext()) { map.addMimetype((MimeType) mimetypes.next()); } Iterator media = mediatypes.iterator(); while (media.hasNext()) { map.addMediaType((MediaType) media.next()); } //Set preferred Mimetype MimeType mimeType = map.getPreferredType(); MediaType mtEntry = getMediaTypeForMimeType(map.getPreferredType().getName()); map.setPreferredMediaType(mtEntry); // Add map to cache capabilityMapCache.put(userAgent, map); return map; } } return map; } /** * Returns the client which matches the given useragent string. * * @param useragent the useragent to match * @return the found client or null if the user-agent does not match any * defined client * @see org.apache.jetspeed.capability.CapabilityService#findClient(java.lang.String) */ public Client findClient(String userAgent) { Client clientEntry = null; Iterator clients = getClients(); if (log.isDebugEnabled()) { log.debug( "ClientRegistry: Looking for client with useragent :" + userAgent); } while (clients.hasNext()) { Client client = (Client) clients.next(); if (client.getUserAgentPattern() != null) { try { // Java 1.4 has regular expressions build in String exp = client.getUserAgentPattern(); //RE r = new RE(client.getUserAgentPattern()); //r.setMatchFlags(RE.MATCH_CASEINDEPENDENT); //if (r.match(userAgent)) if (userAgent.matches(exp)) { if (log.isDebugEnabled()) { log.debug( "Client: " + userAgent + " matches " + client.getUserAgentPattern()); } return client; } else { if (log.isDebugEnabled()) { log.debug( "Client: " + userAgent + " does not match " + client.getUserAgentPattern()); } } } catch (java.util.regex.PatternSyntaxException e) { String message = "CapabilityServiceImpl: UserAgentPattern not valid : " + client.getUserAgentPattern() + " : " + e.getMessage(); log.error(message, e); } } } return clientEntry; } /* * @see org.apache.jetspeed.capability.CapabilityService#getClients() */ public Iterator getClients() { if (null == clients) { PersistenceStore store = getPersistenceStore(); this.clients = store.getExtent(ClientImpl.class); } return this.clients.iterator(); } /* * @see org.apache.jetspeed.capability.CapabilityService#getMediaTypesForMimeTypes(java.util.Iterator) */ public Collection getMediaTypesForMimeTypes(Iterator mimetypes) { //Find the MediaType by matching the Mimetype PersistenceStore store = getPersistenceStore(); Filter filter = store.newFilter(); Vector temp = new Vector(); // Add Mimetypes to map and create query while (mimetypes.hasNext()) { MimeType mt = (MimeType) mimetypes.next(); // Add mimetype to query // Note: mimetypes is a member of MediaTypeImpl // criteria.addEqualTo("mimetypes.name", mt.getName()); //stuff.add(new Integer(mt.getMimetypeId())); temp.add(mt.getName()); } filter.addIn("mimetypes.name", temp); Object query = store.newQuery(mediaTypeClass, filter); Collection co = store.getCollectionByQuery(query); if (co.isEmpty()) { System.out.println("collection is empty"); MediaType mt = getMediaType("html"); Vector v = new Vector(); v.add(mt); return v; } System.out.println("collection is NOT empty"); return co; } /* * @see org.apache.jetspeed.capability.CapabilityService#deleteCapabilityMapCache() */ public void deleteCapabilityMapCache() { capabilityMapCache.clear(); clients = null; } /* (non-Javadoc) * @see org.apache.jetspeed.capability.CapabilityService#getMediaType(java.lang.String) */ public MediaType getMediaType(String mediaType) { PersistenceStore store = getPersistenceStore(); Filter filter = store.newFilter(); filter.addEqualTo("name", mediaType); Object query = store.newQuery(mediaTypeClass, filter); return (MediaType) store.getObjectByQuery(query); } /** * getMediaTypeForMimeType * @param mimeType to use for lookup * @return MediaTypeEntry that matches the lookup in the MEDIATYPE_TO_MIMETYPE table */ public MediaType getMediaTypeForMimeType(String mimeTypeName) { //Find the MediaType by matching the Mimetype PersistenceStore store = getPersistenceStore(); Filter filter = store.newFilter(); filter.addEqualTo("mimetypes.name", mimeTypeName); Object query = store.newQuery(mediaTypeClass, filter); Collection mediaTypeCollection = store.getCollectionByQuery(query); Iterator mtIterator = mediaTypeCollection.iterator(); if (mtIterator.hasNext()) { return (MediaType) mtIterator.next(); } else { return null; } } protected PersistenceStore getPersistenceStore() { PersistenceStore store = pContainer.getStoreForThread(storeName); Transaction tx = store.getTransaction(); if (!tx.isOpen()) { tx.begin(); } return store; } } 1.6 +22 -25 jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/capability/TestCapability.java Index: TestCapability.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/capability/TestCapability.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestCapability.java 4 Feb 2004 21:35:26 -0000 1.5 +++ TestCapability.java 26 Feb 2004 22:50:41 -0000 1.6 @@ -57,11 +57,10 @@ import java.util.Iterator; import junit.framework.Test; -import junit.framework.TestSuite; -import org.apache.commons.configuration.Configuration; -import org.apache.jetspeed.cps.CommonPortletServices; -import org.apache.jetspeed.test.JetspeedTest; -import org.apache.jetspeed.test.JetspeedTestSuite; + +import org.apache.jetspeed.components.AbstractComponentAwareTestCase; +import org.apache.jetspeed.components.ComponentAwareTestSuite; +import org.picocontainer.MutablePicoContainer; /** * Test Capability Service @@ -69,8 +68,10 @@ * @author <a href="[EMAIL PROTECTED]">Roger Ruttimann</a> * @version $Id$ */ -public class TestCapability extends JetspeedTest +public class TestCapability extends AbstractComponentAwareTestCase { + private Capabilities capabilities = null; + private MutablePicoContainer container; /** * @see org.apache.jetspeed.test.JetspeedTest#overrideProperties(org.apache.commons.configuration.Configuration) @@ -101,11 +102,13 @@ new String[] { TestCapability.class.getName()}); } - public void setUp() throws Exception + protected void setUp() throws Exception { - System.out.println("Setup: Testing Capability Service"); super.setUp(); + container = (MutablePicoContainer) getContainer(); + capabilities = (Capabilities) container.getComponentInstance(Capabilities.class); } + /** * Creates the test suite. * @@ -114,14 +117,9 @@ */ public static Test suite() { - // All methods starting with "test" will be executed in the test suite. - return new JetspeedTestSuite(TestCapability.class); - } - - protected CapabilityService getService() - { - return (CapabilityService) CommonPortletServices.getPortalService( - CapabilityService.SERVICE_NAME); + ComponentAwareTestSuite suite = new ComponentAwareTestSuite(TestCapability.class); + suite.setScript("org/apache/jetspeed/capability/containers/capability-container.groovy"); + return suite; } /** @@ -130,8 +128,7 @@ */ public void testCapability() throws Exception { - CapabilityService service = getService(); - assertNotNull("capability service is null", service); + assertNotNull("capabilities component is null", capabilities); // Find specific client -- testing pattern matching String userAgent; @@ -139,37 +136,37 @@ userAgent = "Opera/7.0"; System.out.println("Find pattern: " + userAgent); - CapabilityMap cm = service.getCapabilityMap(userAgent); + CapabilityMap cm = capabilities.getCapabilityMap(userAgent); assertNotNull("getCapabilityMap is null", cm); capabilityMapReport(cm); userAgent = "Mozilla/4.0"; System.out.println("Find pattern: " + userAgent); - cm = service.getCapabilityMap(userAgent); + cm = capabilities.getCapabilityMap(userAgent); assertNotNull("getCapabilityMap is null", cm); capabilityMapReport(cm); userAgent = "MSIE 5.0"; System.out.println("Find pattern: " + userAgent); - cm = service.getCapabilityMap(userAgent); + cm = capabilities.getCapabilityMap(userAgent); assertNotNull("getCapabilityMap is null", cm); capabilityMapReport(cm); userAgent = "Mozilla/5.0"; System.out.println("Find pattern: " + userAgent); - cm = service.getCapabilityMap(userAgent); + cm = capabilities.getCapabilityMap(userAgent); assertNotNull("getCapabilityMap is null", cm); capabilityMapReport(cm); userAgent = "Lynx"; System.out.println("Find pattern: " + userAgent); - cm = service.getCapabilityMap(userAgent); + cm = capabilities.getCapabilityMap(userAgent); assertNotNull("getCapabilityMap is null", cm); capabilityMapReport(cm); userAgent = "Nokia"; System.out.println("Find pattern: " + userAgent); - cm = service.getCapabilityMap(userAgent); + cm = capabilities.getCapabilityMap(userAgent); assertNotNull("getCapabilityMap is null", cm); capabilityMapReport(cm); 1.14 +7 -2 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy Index: jetspeed.groovy =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jetspeed.groovy 26 Feb 2004 17:40:31 -0000 1.13 +++ jetspeed.groovy 26 Feb 2004 22:50:41 -0000 1.14 @@ -33,8 +33,9 @@ import org.apache.jetspeed.cache.file.FileCache import org.apache.jetspeed.profiler.Profiler import org.apache.jetspeed.profiler.impl.JetspeedProfiler - - +import org.apache.jetspeed.capability.Capabilities +import org.apache.jetspeed.capability.impl.JetspeedCapabilities + // WARNING!!!!!! // DO NOT use {Class}.class as it appears to be broken in Groovy // You end getting a Class instance of the type java.lang.Class @@ -136,5 +137,9 @@ // container.registerComponentInstance(Profiler, new JetspeedProfiler(pContainer)) +// +// Capabilities +// +container.registerComponentInstance(Capabilities, new JetspeedCapabilities(pContainer)) return container 1.40 +1 -13 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties Index: jetspeed.properties =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- jetspeed.properties 26 Feb 2004 04:49:04 -0000 1.39 +++ jetspeed.properties 26 Feb 2004 22:50:42 -0000 1.40 @@ -137,18 +137,6 @@ services.PersistenceService.path.resolver.class=org.apache.jetspeed.util.JetspeedPathResloverImpl services.PersistenceService.earlyInit = true - - -# ------------------------------------------------------------------- -# C A P A B I L I T Y -# ------------------------------------------------------------------- -services.capability.classname = org.apache.jetspeed.capability.impl.CapabilityServiceImpl -services.capability.earlyInit = true -services.capability.client.impl = org.apache.jetspeed.capability.impl.ClientImpl -services.capability.mimetype.impl = org.apache.jetspeed.capability.impl.MimeTypeImpl -services.capability.capability.impl = org.apache.jetspeed.capability.impl.CapabilityImpl -services.capability.mediatype.impl = org.apache.jetspeed.capability.impl.MediaTypeImpl - #-------------------------------------------------------------------- # P O R T L E T D E P L O Y M E N T D E S C R I P T O R #-------------------------------------------------------------------- 1.31 +3 -1 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/db/hsql/Registry.script Index: Registry.script =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/db/hsql/Registry.script,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Registry.script 26 Feb 2004 05:15:41 -0000 1.30 +++ Registry.script 26 Feb 2004 22:50:42 -0000 1.31 @@ -1,6 +1,8 @@ CREATE TABLE PORTLET_APPLICATION_DUBLIN_CORE(ID INTEGER NOT NULL PRIMARY KEY) CREATE TABLE PORTLET_APPLICATION_DUBLIN_CORE_FIELDS(ID INTEGER NOT NULL PRIMARY KEY,OBJECT_ID INTEGER NOT NULL,VALUE LONGVARCHAR NOT NULL,LOCALE_STRING VARCHAR(50) NOT NULL) -CREATE TABLE PORTLET_APPLICATION(APPLICATION_ID INTEGER NOT NULL PRIMARY KEY,APP_NAME VARCHAR(80) NOT NULL,APP_IDENTIFIER VARCHAR(80),VERSION VARCHAR(80),APP_TYPE INTEGER,DESCRIPTION VARCHAR(80),WEB_APP_ID INTEGER NOT NULL,DUBLIN_CORE_ID INTEGER NOT NULL,CONSTRAINT UK_APPLICATION UNIQUE(APP_NAME)) +CREATE TABLE PA_METADATA(ID INTEGER NOT NULL PRIMARY KEY) +CREATE TABLE PA_METADATA_FIELDS(ID INTEGER NOT NULL PRIMARY KEY,OBJECT_ID INTEGER NOT NULL,VALUE LONGVARCHAR NOT NULL,NAME VARCHAR(100) NOT NULL,LOCALE_STRING VARCHAR(50) NOT NULL) +CREATE TABLE PORTLET_APPLICATION(APPLICATION_ID INTEGER NOT NULL PRIMARY KEY,APP_NAME VARCHAR(80) NOT NULL,APP_IDENTIFIER VARCHAR(80),VERSION VARCHAR(80),APP_TYPE INTEGER,DESCRIPTION VARCHAR(80),WEB_APP_ID INTEGER NOT NULL,METADATA_ID INTEGER NOT NULL,CONSTRAINT UK_APPLICATION UNIQUE(APP_NAME)) CREATE TABLE WEB_APPLICATION(ID INTEGER NOT NULL PRIMARY KEY,CONTEXT_ROOT VARCHAR(255) NOT NULL) CREATE TABLE PORTLET_DEFINITION(ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(80),CLASS_NAME VARCHAR(100),APPLICATION_ID INTEGER NOT NULL,PORTLET_IDENTIFIER VARCHAR(80),EXPIRATION_CACHE VARCHAR(30),PREFERENCE_VALIDATOR VARCHAR(255),CONSTRAINT SYS_CT_2 UNIQUE(APPLICATION_ID,NAME)) CREATE TABLE LANGUAGE(ID INTEGER NOT NULL PRIMARY KEY,PORTLET_ID INTEGER NOT NULL,TITLE VARCHAR(100),SHORT_TITLE VARCHAR(50),LOCALE_STRING VARCHAR(50) NOT NULL,KEYWORDS LONGVARCHAR)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]