From adffaces-commits-return-252-apmail-incubator-adffaces-commits-archive=incubator.apache.org@incubator.apache.org Tue Jul 25 04:43:31 2006 Return-Path: Delivered-To: apmail-incubator-adffaces-commits-archive@locus.apache.org Received: (qmail 35616 invoked from network); 25 Jul 2006 04:43:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Jul 2006 04:43:31 -0000 Received: (qmail 38101 invoked by uid 500); 25 Jul 2006 04:43:30 -0000 Delivered-To: apmail-incubator-adffaces-commits-archive@incubator.apache.org Received: (qmail 38039 invoked by uid 500); 25 Jul 2006 04:43:29 -0000 Mailing-List: contact adffaces-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: adffaces-dev@incubator.apache.org Delivered-To: mailing list adffaces-commits@incubator.apache.org Received: (qmail 37998 invoked by uid 99); 25 Jul 2006 04:43:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2006 21:43:29 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2006 21:43:23 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 1E8B21A9823; Mon, 24 Jul 2006 21:43:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r425276 [4/12] - in /incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src: main/java/org/apache/myfaces/adfinternal/agent/ main/java/org/apache/myfaces/adfinternal/agent/parse/ main/java/org/apache/myfaces/adfi... Date: Tue, 25 Jul 2006 04:42:46 -0000 To: adffaces-commits@incubator.apache.org From: matzew@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060725044303.1E8B21A9823@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/CapabilityDataDocumentParser.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/CapabilityDataDocumentParser.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/CapabilityDataDocumentParser.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/CapabilityDataDocumentParser.java Mon Jul 24 21:42:41 2006 @@ -13,149 +13,149 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import org.xml.sax.SAXException; -import org.xml.sax.InputSource; -import org.xml.sax.Attributes; -import org.xml.sax.SAXParseException; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.ArrayList; -import java.net.URL; -import java.net.URLConnection; - -import org.apache.myfaces.adf.logging.ADFLogger; -import org.apache.myfaces.adfinternal.agent.CapabilityKey; -import org.apache.myfaces.adfinternal.agent.CapabilityValue; -import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; -import org.apache.myfaces.adfinternal.share.xml.ParseContextImpl; -import org.apache.myfaces.adfinternal.share.xml.TreeBuilder; -import org.apache.myfaces.adfinternal.share.xml.ParseContext; -import org.apache.myfaces.adfinternal.share.xml.NodeParser; - -/** - * CapabilitiesData document parser - */ -public class CapabilityDataDocumentParser extends BaseNodeParser - implements XMLConstants -{ - - private CapabilityDataDocumentParser() - { - } - - static public Object[] parse (URL srcUrl) - { - //if URL is null return empty documen - if (srcUrl == null) - return new Object[0]; - - CapabilityDataDocumentParser parser = new CapabilityDataDocumentParser(); - InputStream stream = null; - try - { - URLConnection connection = srcUrl.openConnection(); - stream = connection.getInputStream(); - - InputSource source = new InputSource(stream); - source.setSystemId(srcUrl.toExternalForm()); - - ParseContextImpl pc = new ParseContextImpl (); - TreeBuilder builder = new TreeBuilder(); - return (Object[]) builder.parse(null, source, pc, parser); - } - catch (SAXException saxe) - { - _LOG.severe("Failed to parse capabilities data document", saxe); - } - catch (IOException ioe) - { - _LOG.severe("Failed to parse capabilities data document", ioe); - } - finally - { - try - { - if (stream != null) - stream.close(); - } - catch (IOException e) - { - //do nothing - ; - } - } - - return new Object[0]; - } - - public void startElement (ParseContext context, - String namespaceURI, - String localName, - Attributes attrs ) - throws SAXParseException - { - if (!NS_URI.equals(namespaceURI)) - { - throw new SAXParseException("Invalid Namespace: " + - namespaceURI, context.getLocator()); - } - } - - public NodeParser startChildElement( - ParseContext context, - String namespaceURI, - String localName, - Attributes attrs) throws SAXParseException - { - if (ELEMENT_CAPABILITY.equals(localName)) - { - String name = attrs.getValue(ATTRIBUTE_NAME); - String value = attrs.getValue(ATTRIBUTE_VALUE); - - if (name != null) - name = name.trim(); - if (value != null) - value = value.trim(); - - - if ((name == null) || (name.length() <= 0) || - (value == null) || (value.length() <= 0)) - { - _LOG.warning("Element " + ELEMENT_CAPABILITIES + - " has missing (or empty) attributes"); - } - - CapabilityKey key = - CapabilityKey.getCapabilityKey(name, true); - Object valueObject = - CapabilityValue.getCapabilityValue(key, value); - - _capList.add(key); - _capList.add(valueObject); - - return this; - } - - return null; - } - - - public Object endElement (ParseContext context, - String namespaceURI, - String localName) - { - if (ELEMENT_CAPABILITY_DATA.equals(localName)) - return _capList.toArray(new Object[_capList.size()]); - - return null; - } - - private List _capList = new ArrayList(); - - static private final ADFLogger _LOG = ADFLogger.createADFLogger(CapabilityDataDocumentParser.class); - -} +package org.apache.myfaces.adfinternal.agent.parse; + +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.ArrayList; +import java.net.URL; +import java.net.URLConnection; + +import org.apache.myfaces.adf.logging.ADFLogger; +import org.apache.myfaces.adfinternal.agent.CapabilityKey; +import org.apache.myfaces.adfinternal.agent.CapabilityValue; +import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; +import org.apache.myfaces.adfinternal.share.xml.ParseContextImpl; +import org.apache.myfaces.adfinternal.share.xml.TreeBuilder; +import org.apache.myfaces.adfinternal.share.xml.ParseContext; +import org.apache.myfaces.adfinternal.share.xml.NodeParser; + +/** + * CapabilitiesData document parser + */ +public class CapabilityDataDocumentParser extends BaseNodeParser + implements XMLConstants +{ + + private CapabilityDataDocumentParser() + { + } + + static public Object[] parse (URL srcUrl) + { + //if URL is null return empty documen + if (srcUrl == null) + return new Object[0]; + + CapabilityDataDocumentParser parser = new CapabilityDataDocumentParser(); + InputStream stream = null; + try + { + URLConnection connection = srcUrl.openConnection(); + stream = connection.getInputStream(); + + InputSource source = new InputSource(stream); + source.setSystemId(srcUrl.toExternalForm()); + + ParseContextImpl pc = new ParseContextImpl (); + TreeBuilder builder = new TreeBuilder(); + return (Object[]) builder.parse(null, source, pc, parser); + } + catch (SAXException saxe) + { + _LOG.severe("Failed to parse capabilities data document", saxe); + } + catch (IOException ioe) + { + _LOG.severe("Failed to parse capabilities data document", ioe); + } + finally + { + try + { + if (stream != null) + stream.close(); + } + catch (IOException e) + { + //do nothing + ; + } + } + + return new Object[0]; + } + + public void startElement (ParseContext context, + String namespaceURI, + String localName, + Attributes attrs ) + throws SAXParseException + { + if (!NS_URI.equals(namespaceURI)) + { + throw new SAXParseException("Invalid Namespace: " + + namespaceURI, context.getLocator()); + } + } + + public NodeParser startChildElement( + ParseContext context, + String namespaceURI, + String localName, + Attributes attrs) throws SAXParseException + { + if (ELEMENT_CAPABILITY.equals(localName)) + { + String name = attrs.getValue(ATTRIBUTE_NAME); + String value = attrs.getValue(ATTRIBUTE_VALUE); + + if (name != null) + name = name.trim(); + if (value != null) + value = value.trim(); + + + if ((name == null) || (name.length() <= 0) || + (value == null) || (value.length() <= 0)) + { + _LOG.warning("Element " + ELEMENT_CAPABILITIES + + " has missing (or empty) attributes"); + } + + CapabilityKey key = + CapabilityKey.getCapabilityKey(name, true); + Object valueObject = + CapabilityValue.getCapabilityValue(key, value); + + _capList.add(key); + _capList.add(valueObject); + + return this; + } + + return null; + } + + + public Object endElement (ParseContext context, + String namespaceURI, + String localName) + { + if (ELEMENT_CAPABILITY_DATA.equals(localName)) + return _capList.toArray(new Object[_capList.size()]); + + return null; + } + + private List _capList = new ArrayList(); + + static private final ADFLogger _LOG = ADFLogger.createADFLogger(CapabilityDataDocumentParser.class); + +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/CapabilityDataDocumentParser.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/ComponentNodeParser.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/ComponentNodeParser.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/ComponentNodeParser.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/ComponentNodeParser.java Mon Jul 24 21:42:41 2006 @@ -13,86 +13,86 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import org.apache.myfaces.adfinternal.share.xml.NodeParser; -import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; -import org.apache.myfaces.adfinternal.share.xml.ParseContext; -import org.xml.sax.Attributes; -import org.xml.sax.SAXParseException; - -import java.util.ArrayList; -import java.util.List; - -/** - * Node parser for component nodes in the capabilities file - */ -class ComponentNodeParser extends BaseNodeParser implements XMLConstants -{ - - public void startElement (ParseContext context, - String namespaceURI, - String localName, - Attributes attrs ) - throws SAXParseException - { - if (!NS_URI.equals(namespaceURI)) - { - throw new SAXParseException("Invalid Namespace: " + - namespaceURI, context.getLocator()); - } - - _type = attrs.getValue(ATTRIBUTE_TYPE); - - } - - public NodeParser startChildElement(ParseContext context, - String namespaceURI, - String localName, - Attributes attrs) - throws SAXParseException - { - if (ELEMENT_INCLUDE.equals(localName)) - return new IncludeNodeParser(); - - //return null; if unknown element - return null; - } - - - public void addCompletedChild (ParseContext context, - String namespaceURI, - String localName, - Object child) - throws SAXParseException - { - if (child == null) - return; - - _includeNodes.add(child); - } - - public Object endElement (ParseContext context, - String namespaceURI, - String localName) - { - ArrayList nodesWithRefList = new ArrayList(_includeNodes.size()); - ArrayList nodesWithSrcList = new ArrayList(_includeNodes.size()); - for (int i = 0; i < _includeNodes.size(); i++) - { - IncludeNode node = (IncludeNode) _includeNodes.get(i); - if (node.__getRefId() != null) - nodesWithRefList.add(node); - else - nodesWithSrcList.add(node); - } - IncludeNode[] nodesWithRef = (IncludeNode[]) - nodesWithRefList.toArray(new IncludeNode[nodesWithRefList.size()]); - IncludeNode[] nodesWithSrc = (IncludeNode[]) - nodesWithSrcList.toArray(new IncludeNode[nodesWithSrcList.size()]); - return new DeviceComponentNode(_type, nodesWithRef, nodesWithSrc); - } - - private List _includeNodes = new ArrayList(); - private String _type; -} +package org.apache.myfaces.adfinternal.agent.parse; + +import org.apache.myfaces.adfinternal.share.xml.NodeParser; +import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; +import org.apache.myfaces.adfinternal.share.xml.ParseContext; +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + +import java.util.ArrayList; +import java.util.List; + +/** + * Node parser for component nodes in the capabilities file + */ +class ComponentNodeParser extends BaseNodeParser implements XMLConstants +{ + + public void startElement (ParseContext context, + String namespaceURI, + String localName, + Attributes attrs ) + throws SAXParseException + { + if (!NS_URI.equals(namespaceURI)) + { + throw new SAXParseException("Invalid Namespace: " + + namespaceURI, context.getLocator()); + } + + _type = attrs.getValue(ATTRIBUTE_TYPE); + + } + + public NodeParser startChildElement(ParseContext context, + String namespaceURI, + String localName, + Attributes attrs) + throws SAXParseException + { + if (ELEMENT_INCLUDE.equals(localName)) + return new IncludeNodeParser(); + + //return null; if unknown element + return null; + } + + + public void addCompletedChild (ParseContext context, + String namespaceURI, + String localName, + Object child) + throws SAXParseException + { + if (child == null) + return; + + _includeNodes.add(child); + } + + public Object endElement (ParseContext context, + String namespaceURI, + String localName) + { + ArrayList nodesWithRefList = new ArrayList(_includeNodes.size()); + ArrayList nodesWithSrcList = new ArrayList(_includeNodes.size()); + for (int i = 0; i < _includeNodes.size(); i++) + { + IncludeNode node = (IncludeNode) _includeNodes.get(i); + if (node.__getRefId() != null) + nodesWithRefList.add(node); + else + nodesWithSrcList.add(node); + } + IncludeNode[] nodesWithRef = (IncludeNode[]) + nodesWithRefList.toArray(new IncludeNode[nodesWithRefList.size()]); + IncludeNode[] nodesWithSrc = (IncludeNode[]) + nodesWithSrcList.toArray(new IncludeNode[nodesWithSrcList.size()]); + return new DeviceComponentNode(_type, nodesWithRef, nodesWithSrc); + } + + private List _includeNodes = new ArrayList(); + private String _type; +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/ComponentNodeParser.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceComponentNode.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceComponentNode.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceComponentNode.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceComponentNode.java Mon Jul 24 21:42:41 2006 @@ -13,102 +13,102 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - - -/** - * Object that holds information about the device component node in capabilities file - */ -class DeviceComponentNode -{ - - /** - * The User Agent component of device - */ - public static final Object TYPE_BROWSER = "browser"; - /** - * The software/os platform of the device - */ - public static final Object TYPE_PLATFORM = "platform"; - /** - * The hardware platform of the device - */ - public static final Object TYPE_HARDWARE = "hardware"; - /** - * The push component of the device - */ - public static final Object TYPE_PUSH = "push"; - /** - * the mms component of the device - */ - public static final Object TYPE_MMS = "mms"; - /** - * unknown component - */ - private static final Object TYPE_UNKNOWN = "unknown"; - - public DeviceComponentNode(String type, - IncludeNode[] nodesWithRef, - IncludeNode[] nodesWithSrc) - { - _type = _getType(type); - _nodesWithRef = nodesWithRef; - _nodesWithSrc = nodesWithSrc; - } - - IncludeNode[] __getIncludesByUri() - { - return _nodesWithSrc; - } - - IncludeNode[] __getIncludesByRef() - { - return _nodesWithRef; - } - - Object __getType() - { - return _type; - } - - - private Object _getType(String type) - { - if (type == null) - return TYPE_UNKNOWN; - - type = type.intern(); - if ((type == TYPE_BROWSER) || - (TYPE_BROWSER.equals(type))) - { - return TYPE_BROWSER; - } - else if ((type == TYPE_PLATFORM) || - (TYPE_PLATFORM.equals(type))) - { - return TYPE_PLATFORM; - } - else if ((type == TYPE_HARDWARE) || - (TYPE_HARDWARE.equals(type))) - { - return TYPE_HARDWARE; - } - else if ((type == TYPE_MMS) || - (TYPE_MMS.equals(type))) - { - return TYPE_MMS; - } - else if ((type == TYPE_PUSH) || - (TYPE_PUSH.equals(type))) - { - return TYPE_PUSH; - } - - return TYPE_UNKNOWN; - } - - - private Object _type; - private IncludeNode[] _nodesWithRef; - private IncludeNode[] _nodesWithSrc; -} +package org.apache.myfaces.adfinternal.agent.parse; + + +/** + * Object that holds information about the device component node in capabilities file + */ +class DeviceComponentNode +{ + + /** + * The User Agent component of device + */ + public static final Object TYPE_BROWSER = "browser"; + /** + * The software/os platform of the device + */ + public static final Object TYPE_PLATFORM = "platform"; + /** + * The hardware platform of the device + */ + public static final Object TYPE_HARDWARE = "hardware"; + /** + * The push component of the device + */ + public static final Object TYPE_PUSH = "push"; + /** + * the mms component of the device + */ + public static final Object TYPE_MMS = "mms"; + /** + * unknown component + */ + private static final Object TYPE_UNKNOWN = "unknown"; + + public DeviceComponentNode(String type, + IncludeNode[] nodesWithRef, + IncludeNode[] nodesWithSrc) + { + _type = _getType(type); + _nodesWithRef = nodesWithRef; + _nodesWithSrc = nodesWithSrc; + } + + IncludeNode[] __getIncludesByUri() + { + return _nodesWithSrc; + } + + IncludeNode[] __getIncludesByRef() + { + return _nodesWithRef; + } + + Object __getType() + { + return _type; + } + + + private Object _getType(String type) + { + if (type == null) + return TYPE_UNKNOWN; + + type = type.intern(); + if ((type == TYPE_BROWSER) || + (TYPE_BROWSER.equals(type))) + { + return TYPE_BROWSER; + } + else if ((type == TYPE_PLATFORM) || + (TYPE_PLATFORM.equals(type))) + { + return TYPE_PLATFORM; + } + else if ((type == TYPE_HARDWARE) || + (TYPE_HARDWARE.equals(type))) + { + return TYPE_HARDWARE; + } + else if ((type == TYPE_MMS) || + (TYPE_MMS.equals(type))) + { + return TYPE_MMS; + } + else if ((type == TYPE_PUSH) || + (TYPE_PUSH.equals(type))) + { + return TYPE_PUSH; + } + + return TYPE_UNKNOWN; + } + + + private Object _type; + private IncludeNode[] _nodesWithRef; + private IncludeNode[] _nodesWithSrc; +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceComponentNode.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNode.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNode.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNode.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNode.java Mon Jul 24 21:42:41 2006 @@ -13,42 +13,42 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import org.apache.myfaces.adf.context.Agent; - -/** - * Object that holds information about the device nodes in capabilities file - */ -class DeviceNode -{ - public DeviceNode(String id, NameVersion makeModel, - String extendsId, DeviceComponentNode[] components) - { - _id = id; - //Really should be using only the name part. There is no version here - _makeModel = makeModel; - _extendsId = extendsId; - _componentNodes = components; - } - - DeviceComponentNode[] __getComponents() - { - return _componentNodes; - } - - double __matches(Agent agent) - { - //TODO: Have a "Does not matter" match constant - if (_makeModel == null) - return 1; - - String makeModel = agent.getHardwareMakeModel(); - return _makeModel.match(makeModel, null); - } - - private String _id; - private NameVersion _makeModel; - private String _extendsId; - private DeviceComponentNode[] _componentNodes; -} +package org.apache.myfaces.adfinternal.agent.parse; + +import org.apache.myfaces.adf.context.Agent; + +/** + * Object that holds information about the device nodes in capabilities file + */ +class DeviceNode +{ + public DeviceNode(String id, NameVersion makeModel, + String extendsId, DeviceComponentNode[] components) + { + _id = id; + //Really should be using only the name part. There is no version here + _makeModel = makeModel; + _extendsId = extendsId; + _componentNodes = components; + } + + DeviceComponentNode[] __getComponents() + { + return _componentNodes; + } + + double __matches(Agent agent) + { + //TODO: Have a "Does not matter" match constant + if (_makeModel == null) + return 1; + + String makeModel = agent.getHardwareMakeModel(); + return _makeModel.match(makeModel, null); + } + + private String _id; + private NameVersion _makeModel; + private String _extendsId; + private DeviceComponentNode[] _componentNodes; +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNode.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNodeParser.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNodeParser.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNodeParser.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNodeParser.java Mon Jul 24 21:42:41 2006 @@ -13,110 +13,110 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import org.apache.myfaces.adfinternal.share.xml.NodeParser; -import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; -import org.apache.myfaces.adfinternal.share.xml.ParseContext; -import org.apache.myfaces.adf.logging.ADFLogger; -import org.xml.sax.Attributes; -import org.xml.sax.SAXParseException; - -import java.util.List; -import java.util.ArrayList; -import java.text.ParseException; - -/** - * NodePaser for device nodes in the capabilities file - */ -class DeviceNodeParser extends BaseNodeParser implements XMLConstants -{ - public void startElement (ParseContext context, - String namespaceURI, - String localName, - Attributes attrs ) - throws SAXParseException - { - if (!NS_URI.equals(namespaceURI)) - { - throw new SAXParseException("Invalid Namespace: " + - namespaceURI, context.getLocator()); - } - - String id = attrs.getValue(ATTRIBUTE_ID); - String model = attrs.getValue(ATTRIBUTE_MODEL); - String extendsId = attrs.getValue(ATTRIBUTE_EXTENDS); - if (((id == null) && (model == null)) || - ((id != null) && (id.trim().length() <= 0)) || - ((model != null) && (model.trim().length() <= 0))) - { - _LOG.warning("Element " + ELEMENT_DEVICE + - " has missing (or empty) attributes"); - } - - _id = id; - _extendsId = extendsId; - if (model != null) - { - try - { - //Really should be using only the name part. There is no version here - _model = new NameVersion(model); - } - catch (ParseException pe) - { - _LOG.warning("Unable to parse model string"); - } - } - } - - - public NodeParser startChildElement(ParseContext context, - String namespaceURI, - String localName, - Attributes attrs) - throws SAXParseException - { - if (ELEMENT_COMPONENT.equals(localName)) - return new ComponentNodeParser(); - - //return null; if unknown element - return null; - - } - - public void addCompletedChild (ParseContext context, - String namespaceURI, - String localName, - Object child) - throws SAXParseException - { - if (child == null) - return; - - _componentNodes.add(child); - } - - public Object endElement (ParseContext context, - String namespaceURI, - String localName) - { - if ((_id == null) && (_model == null)) - return null; - - DeviceComponentNode[] cNodes = (DeviceComponentNode[]) - _componentNodes.toArray( - new DeviceComponentNode[_componentNodes.size()]); - return new DeviceNode(_id, _model, _extendsId, cNodes); - } - - - private String _id; - private NameVersion _model; - private String _extendsId; - private List _componentNodes = new ArrayList(); - - static private final ADFLogger _LOG = ADFLogger.createADFLogger(DeviceNodeParser.class); -} - - +package org.apache.myfaces.adfinternal.agent.parse; + +import org.apache.myfaces.adfinternal.share.xml.NodeParser; +import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; +import org.apache.myfaces.adfinternal.share.xml.ParseContext; +import org.apache.myfaces.adf.logging.ADFLogger; +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + +import java.util.List; +import java.util.ArrayList; +import java.text.ParseException; + +/** + * NodePaser for device nodes in the capabilities file + */ +class DeviceNodeParser extends BaseNodeParser implements XMLConstants +{ + public void startElement (ParseContext context, + String namespaceURI, + String localName, + Attributes attrs ) + throws SAXParseException + { + if (!NS_URI.equals(namespaceURI)) + { + throw new SAXParseException("Invalid Namespace: " + + namespaceURI, context.getLocator()); + } + + String id = attrs.getValue(ATTRIBUTE_ID); + String model = attrs.getValue(ATTRIBUTE_MODEL); + String extendsId = attrs.getValue(ATTRIBUTE_EXTENDS); + if (((id == null) && (model == null)) || + ((id != null) && (id.trim().length() <= 0)) || + ((model != null) && (model.trim().length() <= 0))) + { + _LOG.warning("Element " + ELEMENT_DEVICE + + " has missing (or empty) attributes"); + } + + _id = id; + _extendsId = extendsId; + if (model != null) + { + try + { + //Really should be using only the name part. There is no version here + _model = new NameVersion(model); + } + catch (ParseException pe) + { + _LOG.warning("Unable to parse model string"); + } + } + } + + + public NodeParser startChildElement(ParseContext context, + String namespaceURI, + String localName, + Attributes attrs) + throws SAXParseException + { + if (ELEMENT_COMPONENT.equals(localName)) + return new ComponentNodeParser(); + + //return null; if unknown element + return null; + + } + + public void addCompletedChild (ParseContext context, + String namespaceURI, + String localName, + Object child) + throws SAXParseException + { + if (child == null) + return; + + _componentNodes.add(child); + } + + public Object endElement (ParseContext context, + String namespaceURI, + String localName) + { + if ((_id == null) && (_model == null)) + return null; + + DeviceComponentNode[] cNodes = (DeviceComponentNode[]) + _componentNodes.toArray( + new DeviceComponentNode[_componentNodes.size()]); + return new DeviceNode(_id, _model, _extendsId, cNodes); + } + + + private String _id; + private NameVersion _model; + private String _extendsId; + private List _componentNodes = new ArrayList(); + + static private final ADFLogger _LOG = ADFLogger.createADFLogger(DeviceNodeParser.class); +} + + Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/DeviceNodeParser.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNode.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNode.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNode.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNode.java Mon Jul 24 21:42:41 2006 @@ -13,33 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import java.net.URL; - -/** - * Object that holds information about the include node in capabilities file - */ -class IncludeNode -{ - - IncludeNode(String refid, URL srcUrl) - { - _refid = refid; - _srcUrl = srcUrl; - } - - String __getRefId() - { - return _refid; - } - - URL __getSrcUrl() - { - return _srcUrl; - } - - private String _refid; - private URL _srcUrl; - -} +package org.apache.myfaces.adfinternal.agent.parse; + +import java.net.URL; + +/** + * Object that holds information about the include node in capabilities file + */ +class IncludeNode +{ + + IncludeNode(String refid, URL srcUrl) + { + _refid = refid; + _srcUrl = srcUrl; + } + + String __getRefId() + { + return _refid; + } + + URL __getSrcUrl() + { + return _srcUrl; + } + + private String _refid; + private URL _srcUrl; + +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNode.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNodeParser.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNodeParser.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNodeParser.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNodeParser.java Mon Jul 24 21:42:41 2006 @@ -13,87 +13,87 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; -import org.apache.myfaces.adfinternal.share.xml.ParseContext; -import org.apache.myfaces.adf.logging.ADFLogger; -import org.xml.sax.Attributes; -import org.xml.sax.SAXParseException; - -import java.net.URL; -import java.net.MalformedURLException; - -/** - * NodePaser for include nodes in the capabilities file - */ -class IncludeNodeParser extends BaseNodeParser implements XMLConstants -{ - - public void startElement (ParseContext context, - String namespaceURI, - String localName, - Attributes attrs ) - throws SAXParseException - { - if (!NS_URI.equals(namespaceURI)) - { - throw new SAXParseException("Invalid Namespace: " + - namespaceURI, context.getLocator()); - } - - String refId = attrs.getValue(ATTRIBUTE_REFID); - String src = attrs.getValue(ATTRIBUTE_SRC); - if (((refId == null) && (src == null)) || - ((refId != null) && (refId.length() <= 0)) || - ((src != null) && (src.length() <= 0))) - { - _LOG.warning("Element " + ELEMENT_INCLUDE + - " has missing (or empty) attributes"); - return; - } - - _src = src; - _refId = refId; - } - - public Object endElement (ParseContext context, - String namespaceURI, - String localName) - { - URL srcUrl = _getUrl(context, _src); - if ((_refId == null) && (srcUrl == null)) - return null; - - return new IncludeNode(_refId, srcUrl); - } - - private URL _getUrl(ParseContext context, String url) - { - if (url == null) - return null; - - - URL baseURL = (URL) context.getProperty(NS_URI, - CapabilitiesDocumentParser.__BASE_URL); - try - { - if (baseURL != null) - return new URL(baseURL, url); - - return new URL(url); - } - catch (MalformedURLException mue) - { - _LOG.warning("Capability data url " + _src + " is invalid"); - } - - return null; - } - - - private String _src; - private String _refId; - - static private final ADFLogger _LOG = ADFLogger.createADFLogger(IncludeNodeParser.class); -} +package org.apache.myfaces.adfinternal.agent.parse; + +import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser; +import org.apache.myfaces.adfinternal.share.xml.ParseContext; +import org.apache.myfaces.adf.logging.ADFLogger; +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + +import java.net.URL; +import java.net.MalformedURLException; + +/** + * NodePaser for include nodes in the capabilities file + */ +class IncludeNodeParser extends BaseNodeParser implements XMLConstants +{ + + public void startElement (ParseContext context, + String namespaceURI, + String localName, + Attributes attrs ) + throws SAXParseException + { + if (!NS_URI.equals(namespaceURI)) + { + throw new SAXParseException("Invalid Namespace: " + + namespaceURI, context.getLocator()); + } + + String refId = attrs.getValue(ATTRIBUTE_REFID); + String src = attrs.getValue(ATTRIBUTE_SRC); + if (((refId == null) && (src == null)) || + ((refId != null) && (refId.length() <= 0)) || + ((src != null) && (src.length() <= 0))) + { + _LOG.warning("Element " + ELEMENT_INCLUDE + + " has missing (or empty) attributes"); + return; + } + + _src = src; + _refId = refId; + } + + public Object endElement (ParseContext context, + String namespaceURI, + String localName) + { + URL srcUrl = _getUrl(context, _src); + if ((_refId == null) && (srcUrl == null)) + return null; + + return new IncludeNode(_refId, srcUrl); + } + + private URL _getUrl(ParseContext context, String url) + { + if (url == null) + return null; + + + URL baseURL = (URL) context.getProperty(NS_URI, + CapabilitiesDocumentParser.__BASE_URL); + try + { + if (baseURL != null) + return new URL(baseURL, url); + + return new URL(url); + } + catch (MalformedURLException mue) + { + _LOG.warning("Capability data url " + _src + " is invalid"); + } + + return null; + } + + + private String _src; + private String _refId; + + static private final ADFLogger _LOG = ADFLogger.createADFLogger(IncludeNodeParser.class); +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/IncludeNodeParser.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/NameVersion.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/NameVersion.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/NameVersion.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/NameVersion.java Mon Jul 24 21:42:41 2006 @@ -13,505 +13,505 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import java.util.ArrayList; -import java.util.Iterator; -import java.text.ParseException; - -/** - * An implementation that encapsulates "Name/Version Name/version ..." string and - * supports a match method for matching other names and versions - *

- * Name String can contain .*'s wild char - * //TODO: Check if Name String *really* needs to support wild char - *

- * Version string can contain +'s or *'s at the end - * "*" at the end of version implies an 5xx.xx.xx version - * "+" at the end implies greater than version 5 - * E.g "ie/5* ie/5.5+" - *

- *

- * the name can have wild char charactes (at the end) - * the version string may contain wild char or "+" (at the end) - * - */ -class NameVersion -{ - - NameVersion(String value) throws ParseException - { - _entries = _parseEntries(value); - } - - public double match(String name, VersionId version) - { - if (_entries == null) - return 0; - - if (name == null) - return 0; - - double score = 0; - for (int i = 0; i < _entries.length; i++) - { - Object[] entry = (Object[]) _entries[i]; - if (entry[0] != null) - { - double score1 = _matchName((NameEntry) entry[0], name); - if (score1 > 0) - { - if ((entry[1] == null) & (score1 >= score)) - { - score = score1; - } - else - { - double score2 = _matchVersion((VersionEntry) entry[1], version); - //a match only if the score is > 0 - if ((score2 > 0) && (score1 + score2 >= score)) - score = score1 + score2; - } - } - } - } - - return score; - } - - - /** - * Parse the condtions into an an array of [name, version] pairs - * Right now the parse routine is very forgiving. - * It will parse strings like "name/version/something", "name///version" - * - * @param value - * @return - */ - private Object[] _parseEntries(String value) - throws ParseException - { - - if (value == null) - return null; - - int length = value.length(); - char[] data = new char[length + 1]; - - - value.getChars(0, length, data, 0); - data[length] = (char) 0x1000000; //untype-able ascii char; - - boolean inQuote = false; - int start = 0; - int i = 0; - char ch = data[i]; - - ArrayList entries = new ArrayList(5); - VersionEntry vEntry = null; - NameEntry head, curr; - head = curr = new NameEntry(); - curr.next = curr; - - while (i < length + 1) - { - switch (ch) - { - case '\'': - if (!inQuote) - inQuote = true; - else - { - inQuote = false; - if (start != i) - throw new ParseException("Unexpected '\\'.", i); - } - - ch = data[++i]; - break; - case '\\': - //skip the next char - //Since we only support '.*', throw error - ch = data[++i]; - if ((ch != '.') || (ch != '\\')) - throw new ParseException("Unexpected character. Expecting '.' or '\\' ", i); - ch = data[++i]; - break; - case '.': - if (start != i) - { - curr.next.text = new String(data, start, i - start); - curr = curr.next; - curr.next = new NameEntry(); - } - - //We only support '.*' - ch = data[++i]; - if (ch != '*') - throw new ParseException("Unexpected character. Expecting '*'", i); - - curr.next.text = _WILD_CHAR_STRING; - curr = curr.next; - curr.next = new NameEntry(); - ch = data[++i]; - start = i; - break; - case '/': - if (start != i) - { - curr.next.text = new String(data, start, i - start); - curr = curr.next; - curr.next = new NameEntry(); - } - - ch = data[++i]; - start = i; - if (inQuote) - { - while ((ch != '\'') && (ch != (char) 0x1000000)) - ch = data[++i]; - } - else - { - while (!Character.isSpace(ch) && (ch != (char) 0x1000000)) - ch = data[++i]; - } - - if (i - start <= 0) - throw new ParseException("Expecting char", i); - - vEntry = _parseVersion(new String(data, start, i - start), i); - start = i; - break; - case ((char) 0x1000000): - if (inQuote) - throw new ParseException("Unterminated quote.", i); - - if (start != i) - { - curr.next.text = new String(data, start, i - start); - curr = curr.next; - curr.next = new NameEntry(); - } - - if (head.text != null) - { - NameEntry temp = curr.next; - curr.next = null; - Object[] obj = new Object[]{head, vEntry}; - curr = head = temp; - curr.next = curr; - entries.add(obj); - vEntry = null; - } - i++; - break; - default: - if ((!inQuote) && (Character.isSpace(ch))) - { - if (start != i) - { - curr.next.text = new String(data, start, i - start); - curr = curr.next; - curr.next = new NameEntry(); - } - - if (head.text != null) - { - NameEntry temp = curr.next; - curr.next = null; - Object[] obj = new Object[]{head, vEntry}; - curr = head = temp; - curr.next = curr; - entries.add(obj); - vEntry = null; - } - //Skip space - ch = data[++i]; - while (Character.isSpace(ch)) - ch = data[++i]; - start = i; - } - - ch = data[++i]; - break; - } - } - - return entries.toArray(new Object[entries.size()]); - } - - /** - * @param value - * @return parse and return Entry for Name. '.' is delimiter for version numbers. - * '+' or '*' are treated as special chars and are allowed only at the end - * of the version string - */ - private VersionEntry _parseVersion(String value, - int offset) throws ParseException - { - - int length = value.length(); - char[] data = new char[length + 1]; - int i = 0; - - value.getChars(0, length, data, 0); - data[length] = (char) 0x1000000; //untype-able ascii char; - - char ch = data[i]; - VersionEntry vEntry = new VersionEntry(); - while (i < length + 1) - { - switch (ch) - { - case ((char) 0x1000000): - String version = value.substring(0, i); - //if the version string was simpley "*" or "+" - if (version.length() == 0) - return null; - vEntry._versionId = new VersionId(version); - vEntry._type = VersionEntry.EXACT_TYPE; - i++; - break; - case '*': - case '+': - //After '*' anything other than space is invalid - //After '+' anything other than space is invalid - version = value.substring(0, i); - for (++i; i < length; i++) - { - if (!Character.isSpace(ch)) - throw new ParseException("Unexpected char.", offset + i); - } - //if the version string was simpley "*" or "+" - if (version.length() == 0) - return null; - vEntry._versionId = new VersionId(version); - if (ch == '*') - vEntry._type = VersionEntry.STAR_TYPE; - else - vEntry._type = VersionEntry.PLUS_TYPE; - - ///exit the for loop, last char is 0x1000000 - i++; - break; - default: - ch = data[++i]; - - } - } - - return vEntry; - } - - - /** - * Match and score the name with the NameEntry in this condition - * - * @param entry - * @param matchValue - * @return - */ - private double _matchName(NameEntry entry, - String matchValue) - { - if (matchValue == null) - return NO_MATCH; - - int strLen = matchValue.length(); - - int len = 0; - if (entry.text != _WILD_CHAR_STRING) - { - if (matchValue.indexOf(entry.text, len) == 0) - { - len = entry.text.length(); - if ((entry = entry.next) == null) - return NAME_EXACT_MATCH; - } - else - return NO_MATCH; - } - - while (entry.next != null) - { - if (entry.text != _WILD_CHAR_STRING) - { - int index = matchValue.indexOf(entry.text, len); - if (index == -1) - return NO_MATCH; - len = index + entry.text.length(); - } - entry = entry.next; - } - - if (entry.text != _WILD_CHAR_STRING) - { - if (!matchValue.endsWith(entry.text)) - return NO_MATCH; - } - - return (NAME_STAR_MATCH * (((double) len) / ((double) strLen))); - } - - - /** - * Match and score the name with the VersionEntry in this condition - * - * @param entry - * @param version - * @return - */ - private double _matchVersion(VersionEntry entry, - VersionId version) - { - if (version == null) - return NO_MATCH; //request has no version info, but entry has version requirement. Hence no match - - if (entry._type == VersionEntry.STAR_TYPE) - { - Iterator vIterator1 = version.iterator(); - Iterator vIterator2 = entry._versionId.iterator(); - - //Check upto where both have values - int matchedParts = 0; - while ((vIterator1.hasNext()) && (vIterator2.hasNext())) - { - String part1 = (String) vIterator1.next(); - String part2 = (String) vIterator2.next(); - if (!part1.equals(part2)) - return NO_MATCH; - matchedParts++; - } - - //So far they match. Now if version condition has more - //parts (sub versions), then it must be .0's - while (vIterator2.hasNext()) - { - if (!"0".equals((String) vIterator2.next())) - return NO_MATCH; - } - - //now check how many parts the VersionId has - int totNoOfParts = matchedParts; - while (vIterator1.hasNext()) - { - totNoOfParts++; - vIterator1.next(); - } - - - return (VERSION_STAR_MATCH * matchedParts / totNoOfParts); - } - else if (entry._type == VersionEntry.PLUS_TYPE) - { - Iterator vIterator1 = version.iterator(); - Iterator vIterator2 = entry._versionId.iterator(); - - //Check upto where both have values - while ((vIterator1.hasNext()) && (vIterator2.hasNext())) - { - try - { - int v1 = Integer.parseInt((String) vIterator1.next()); - int v2 = Integer.parseInt((String) vIterator2.next()); - if (v1 > v2) - return (VERSION_GE_MATCH * (entry._versionId.getVersion() / version.getVersion())); - else if (v1 < v2) - return NO_MATCH; - } - catch (NumberFormatException npe) - { - return NO_MATCH; - } - } - - //if we reach here they two number are equal so far - //Check if remaining are .0's - while (vIterator2.hasNext()) - { - try - { - if (Integer.parseInt((String) vIterator2.next()) != 0) - return NO_MATCH; - } - catch (NumberFormatException npe) - { - return NO_MATCH; - } - } - - return (VERSION_GE_MATCH * (entry._versionId.getVersion() / version.getVersion())); - } - else - { - //exact match - Iterator vIterator1 = version.iterator(); - Iterator vIterator2 = entry._versionId.iterator(); - - //Check upto where both have values - while ((vIterator1.hasNext()) && (vIterator2.hasNext())) - { - String part1 = (String) vIterator1.next(); - String part2 = (String) vIterator2.next(); - if (!part1.equals(part2)) - return NO_MATCH; - } - - while (vIterator1.hasNext()) - { - if (!"0".equals((String) vIterator1.next())) - return NO_MATCH; - } - - while (vIterator2.hasNext()) - { - if (!"0".equals((String) vIterator2.next())) - return NO_MATCH; - } - - return VERSION_EXACT_MATCH; - } - } - - - //structure to store the parsed parts of a name - private class NameEntry - { - String text; - NameEntry next; - } - - private class VersionEntry - { - static final int EXACT_TYPE = 0; - static final int PLUS_TYPE = 1; - static final int STAR_TYPE = 2; - - /* type EXACT_TYPE, PLUS_TYPE, STAR_TYPE*/ - int _type; - VersionId _versionId; - } - - private Object[] _entries; - - private final static char _WILD_CHAR = 0x00002A; - private final static String _WILD_CHAR_STRING = String.valueOf(_WILD_CHAR); - - - /** - * Name match has a much higher weightage. - * Any string/version with wild char __matches gets a slightly lower score - * so an input string "xxx" __matches "xxx" and "xxx.*", but a "xxx" match - * gets an higher score - */ - private final static double NAME_EXACT_MATCH = 1000; - private final static double NAME_STAR_MATCH = NAME_EXACT_MATCH - 1; - - private final static double VERSION_EXACT_MATCH = 10; - private final static double VERSION_GE_MATCH = 1; - private final static double VERSION_STAR_MATCH = VERSION_EXACT_MATCH - 1; - - public final static double NO_MATCH = 0x0000; - +package org.apache.myfaces.adfinternal.agent.parse; + +import java.util.ArrayList; +import java.util.Iterator; +import java.text.ParseException; + +/** + * An implementation that encapsulates "Name/Version Name/version ..." string and + * supports a match method for matching other names and versions + *

+ * Name String can contain .*'s wild char + * //TODO: Check if Name String *really* needs to support wild char + *

+ * Version string can contain +'s or *'s at the end + * "*" at the end of version implies an 5xx.xx.xx version + * "+" at the end implies greater than version 5 + * E.g "ie/5* ie/5.5+" + *

+ *

+ * the name can have wild char charactes (at the end) + * the version string may contain wild char or "+" (at the end) + * + */ +class NameVersion +{ + + NameVersion(String value) throws ParseException + { + _entries = _parseEntries(value); + } + + public double match(String name, VersionId version) + { + if (_entries == null) + return 0; + + if (name == null) + return 0; + + double score = 0; + for (int i = 0; i < _entries.length; i++) + { + Object[] entry = (Object[]) _entries[i]; + if (entry[0] != null) + { + double score1 = _matchName((NameEntry) entry[0], name); + if (score1 > 0) + { + if ((entry[1] == null) & (score1 >= score)) + { + score = score1; + } + else + { + double score2 = _matchVersion((VersionEntry) entry[1], version); + //a match only if the score is > 0 + if ((score2 > 0) && (score1 + score2 >= score)) + score = score1 + score2; + } + } + } + } + + return score; + } + + + /** + * Parse the condtions into an an array of [name, version] pairs + * Right now the parse routine is very forgiving. + * It will parse strings like "name/version/something", "name///version" + * + * @param value + * @return + */ + private Object[] _parseEntries(String value) + throws ParseException + { + + if (value == null) + return null; + + int length = value.length(); + char[] data = new char[length + 1]; + + + value.getChars(0, length, data, 0); + data[length] = (char) 0x1000000; //untype-able ascii char; + + boolean inQuote = false; + int start = 0; + int i = 0; + char ch = data[i]; + + ArrayList entries = new ArrayList(5); + VersionEntry vEntry = null; + NameEntry head, curr; + head = curr = new NameEntry(); + curr.next = curr; + + while (i < length + 1) + { + switch (ch) + { + case '\'': + if (!inQuote) + inQuote = true; + else + { + inQuote = false; + if (start != i) + throw new ParseException("Unexpected '\\'.", i); + } + + ch = data[++i]; + break; + case '\\': + //skip the next char + //Since we only support '.*', throw error + ch = data[++i]; + if ((ch != '.') || (ch != '\\')) + throw new ParseException("Unexpected character. Expecting '.' or '\\' ", i); + ch = data[++i]; + break; + case '.': + if (start != i) + { + curr.next.text = new String(data, start, i - start); + curr = curr.next; + curr.next = new NameEntry(); + } + + //We only support '.*' + ch = data[++i]; + if (ch != '*') + throw new ParseException("Unexpected character. Expecting '*'", i); + + curr.next.text = _WILD_CHAR_STRING; + curr = curr.next; + curr.next = new NameEntry(); + ch = data[++i]; + start = i; + break; + case '/': + if (start != i) + { + curr.next.text = new String(data, start, i - start); + curr = curr.next; + curr.next = new NameEntry(); + } + + ch = data[++i]; + start = i; + if (inQuote) + { + while ((ch != '\'') && (ch != (char) 0x1000000)) + ch = data[++i]; + } + else + { + while (!Character.isSpace(ch) && (ch != (char) 0x1000000)) + ch = data[++i]; + } + + if (i - start <= 0) + throw new ParseException("Expecting char", i); + + vEntry = _parseVersion(new String(data, start, i - start), i); + start = i; + break; + case ((char) 0x1000000): + if (inQuote) + throw new ParseException("Unterminated quote.", i); + + if (start != i) + { + curr.next.text = new String(data, start, i - start); + curr = curr.next; + curr.next = new NameEntry(); + } + + if (head.text != null) + { + NameEntry temp = curr.next; + curr.next = null; + Object[] obj = new Object[]{head, vEntry}; + curr = head = temp; + curr.next = curr; + entries.add(obj); + vEntry = null; + } + i++; + break; + default: + if ((!inQuote) && (Character.isSpace(ch))) + { + if (start != i) + { + curr.next.text = new String(data, start, i - start); + curr = curr.next; + curr.next = new NameEntry(); + } + + if (head.text != null) + { + NameEntry temp = curr.next; + curr.next = null; + Object[] obj = new Object[]{head, vEntry}; + curr = head = temp; + curr.next = curr; + entries.add(obj); + vEntry = null; + } + //Skip space + ch = data[++i]; + while (Character.isSpace(ch)) + ch = data[++i]; + start = i; + } + + ch = data[++i]; + break; + } + } + + return entries.toArray(new Object[entries.size()]); + } + + /** + * @param value + * @return parse and return Entry for Name. '.' is delimiter for version numbers. + * '+' or '*' are treated as special chars and are allowed only at the end + * of the version string + */ + private VersionEntry _parseVersion(String value, + int offset) throws ParseException + { + + int length = value.length(); + char[] data = new char[length + 1]; + int i = 0; + + value.getChars(0, length, data, 0); + data[length] = (char) 0x1000000; //untype-able ascii char; + + char ch = data[i]; + VersionEntry vEntry = new VersionEntry(); + while (i < length + 1) + { + switch (ch) + { + case ((char) 0x1000000): + String version = value.substring(0, i); + //if the version string was simpley "*" or "+" + if (version.length() == 0) + return null; + vEntry._versionId = new VersionId(version); + vEntry._type = VersionEntry.EXACT_TYPE; + i++; + break; + case '*': + case '+': + //After '*' anything other than space is invalid + //After '+' anything other than space is invalid + version = value.substring(0, i); + for (++i; i < length; i++) + { + if (!Character.isSpace(ch)) + throw new ParseException("Unexpected char.", offset + i); + } + //if the version string was simpley "*" or "+" + if (version.length() == 0) + return null; + vEntry._versionId = new VersionId(version); + if (ch == '*') + vEntry._type = VersionEntry.STAR_TYPE; + else + vEntry._type = VersionEntry.PLUS_TYPE; + + ///exit the for loop, last char is 0x1000000 + i++; + break; + default: + ch = data[++i]; + + } + } + + return vEntry; + } + + + /** + * Match and score the name with the NameEntry in this condition + * + * @param entry + * @param matchValue + * @return + */ + private double _matchName(NameEntry entry, + String matchValue) + { + if (matchValue == null) + return NO_MATCH; + + int strLen = matchValue.length(); + + int len = 0; + if (entry.text != _WILD_CHAR_STRING) + { + if (matchValue.indexOf(entry.text, len) == 0) + { + len = entry.text.length(); + if ((entry = entry.next) == null) + return NAME_EXACT_MATCH; + } + else + return NO_MATCH; + } + + while (entry.next != null) + { + if (entry.text != _WILD_CHAR_STRING) + { + int index = matchValue.indexOf(entry.text, len); + if (index == -1) + return NO_MATCH; + len = index + entry.text.length(); + } + entry = entry.next; + } + + if (entry.text != _WILD_CHAR_STRING) + { + if (!matchValue.endsWith(entry.text)) + return NO_MATCH; + } + + return (NAME_STAR_MATCH * (((double) len) / ((double) strLen))); + } + + + /** + * Match and score the name with the VersionEntry in this condition + * + * @param entry + * @param version + * @return + */ + private double _matchVersion(VersionEntry entry, + VersionId version) + { + if (version == null) + return NO_MATCH; //request has no version info, but entry has version requirement. Hence no match + + if (entry._type == VersionEntry.STAR_TYPE) + { + Iterator vIterator1 = version.iterator(); + Iterator vIterator2 = entry._versionId.iterator(); + + //Check upto where both have values + int matchedParts = 0; + while ((vIterator1.hasNext()) && (vIterator2.hasNext())) + { + String part1 = (String) vIterator1.next(); + String part2 = (String) vIterator2.next(); + if (!part1.equals(part2)) + return NO_MATCH; + matchedParts++; + } + + //So far they match. Now if version condition has more + //parts (sub versions), then it must be .0's + while (vIterator2.hasNext()) + { + if (!"0".equals((String) vIterator2.next())) + return NO_MATCH; + } + + //now check how many parts the VersionId has + int totNoOfParts = matchedParts; + while (vIterator1.hasNext()) + { + totNoOfParts++; + vIterator1.next(); + } + + + return (VERSION_STAR_MATCH * matchedParts / totNoOfParts); + } + else if (entry._type == VersionEntry.PLUS_TYPE) + { + Iterator vIterator1 = version.iterator(); + Iterator vIterator2 = entry._versionId.iterator(); + + //Check upto where both have values + while ((vIterator1.hasNext()) && (vIterator2.hasNext())) + { + try + { + int v1 = Integer.parseInt((String) vIterator1.next()); + int v2 = Integer.parseInt((String) vIterator2.next()); + if (v1 > v2) + return (VERSION_GE_MATCH * (entry._versionId.getVersion() / version.getVersion())); + else if (v1 < v2) + return NO_MATCH; + } + catch (NumberFormatException npe) + { + return NO_MATCH; + } + } + + //if we reach here they two number are equal so far + //Check if remaining are .0's + while (vIterator2.hasNext()) + { + try + { + if (Integer.parseInt((String) vIterator2.next()) != 0) + return NO_MATCH; + } + catch (NumberFormatException npe) + { + return NO_MATCH; + } + } + + return (VERSION_GE_MATCH * (entry._versionId.getVersion() / version.getVersion())); + } + else + { + //exact match + Iterator vIterator1 = version.iterator(); + Iterator vIterator2 = entry._versionId.iterator(); + + //Check upto where both have values + while ((vIterator1.hasNext()) && (vIterator2.hasNext())) + { + String part1 = (String) vIterator1.next(); + String part2 = (String) vIterator2.next(); + if (!part1.equals(part2)) + return NO_MATCH; + } + + while (vIterator1.hasNext()) + { + if (!"0".equals((String) vIterator1.next())) + return NO_MATCH; + } + + while (vIterator2.hasNext()) + { + if (!"0".equals((String) vIterator2.next())) + return NO_MATCH; + } + + return VERSION_EXACT_MATCH; + } + } + + + //structure to store the parsed parts of a name + private class NameEntry + { + String text; + NameEntry next; + } + + private class VersionEntry + { + static final int EXACT_TYPE = 0; + static final int PLUS_TYPE = 1; + static final int STAR_TYPE = 2; + + /* type EXACT_TYPE, PLUS_TYPE, STAR_TYPE*/ + int _type; + VersionId _versionId; + } + + private Object[] _entries; + + private final static char _WILD_CHAR = 0x00002A; + private final static String _WILD_CHAR_STRING = String.valueOf(_WILD_CHAR); + + + /** + * Name match has a much higher weightage. + * Any string/version with wild char __matches gets a slightly lower score + * so an input string "xxx" __matches "xxx" and "xxx.*", but a "xxx" match + * gets an higher score + */ + private final static double NAME_EXACT_MATCH = 1000; + private final static double NAME_STAR_MATCH = NAME_EXACT_MATCH - 1; + + private final static double VERSION_EXACT_MATCH = 10; + private final static double VERSION_GE_MATCH = 1; + private final static double VERSION_STAR_MATCH = VERSION_EXACT_MATCH - 1; + + public final static double NO_MATCH = 0x0000; + } Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/NameVersion.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/VersionId.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/VersionId.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/VersionId.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/VersionId.java Mon Jul 24 21:42:41 2006 @@ -13,172 +13,172 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -import java.util.Iterator; - - -/** - * A parsed version string - */ -public class VersionId -{ - - public VersionId(String version) - { - if (version == null) - return; - _versionString = version; - _version = _parseVersion(version); - } - - public String toString() - { - return _versionString; - } - - public double getVersion() - { - double version = 0; - if (_versionString != null) - { - boolean hasDecimal = false; - double divisor = 10.0; - - int sourceLength = _versionString.length(); - int currIndex = 0; - - while (currIndex < sourceLength) - { - char currChar = _versionString.charAt(currIndex); - if ((currChar >= '0') && (currChar <= '9')) - { - double addValue = (double) (currChar - '0'); - if (hasDecimal) - { - // handle digits to right of decimal - addValue /= divisor; - divisor = divisor * 10.0; - } - else - { - // handle digits to left of decimal - version *= 10.0; - } - version += addValue; - } - else - { - - if (currChar == '.') - { - // found decimal place - hasDecimal = true; - } - else - { - break; - } - } - // read next char - currIndex++; - } - } - return version; - } - - - public Iterator iterator() - { - return new VIterator(); - } - - private Entry _parseVersion(String value) - { - - int start = 0; - int length = value.length(); - char[] data = new char[length + 1]; - int i = 0; - - value.getChars(0, length, data, 0); - data[length] = (char) 0x1000000; //untype-able ascii char; - char ch = data[i]; - - Entry head, curr; - head = curr = new Entry(); - curr.next = curr; - - while (i < length + 1) - { - //Ignore spaces. TODO: This should happen only for start and end (trim). - while (Character.isSpace(ch)) - ch = data[++i]; - - switch (ch) - { - case '.': - if (start != i) - { - curr.next.text = new String(data, start, i - start); - curr = curr.next; - curr.next = new Entry(); - } - ch = data[++i]; - start = i; - break; - case ((char) 0x1000000): - if (start != i) - { - curr.next.text = new String(data, start, i - start); - curr = curr.next; - curr.next = new Entry(); - } - i++; - break; - default: - ch = data[++i]; - } - } - - curr.next = null; - return head; - } - - private class Entry - { - String text; - Entry next; - } - - private class VIterator implements Iterator - { - public VIterator() - { - _current = _version; - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() - { - return (null != _current); - } - - public Object next() - { - String part = _current.text; - _current = _current.next; - return part; - } - - private Entry _current; - } - - private String _versionString; - private Entry _version; -} - +package org.apache.myfaces.adfinternal.agent.parse; + +import java.util.Iterator; + + +/** + * A parsed version string + */ +public class VersionId +{ + + public VersionId(String version) + { + if (version == null) + return; + _versionString = version; + _version = _parseVersion(version); + } + + public String toString() + { + return _versionString; + } + + public double getVersion() + { + double version = 0; + if (_versionString != null) + { + boolean hasDecimal = false; + double divisor = 10.0; + + int sourceLength = _versionString.length(); + int currIndex = 0; + + while (currIndex < sourceLength) + { + char currChar = _versionString.charAt(currIndex); + if ((currChar >= '0') && (currChar <= '9')) + { + double addValue = (double) (currChar - '0'); + if (hasDecimal) + { + // handle digits to right of decimal + addValue /= divisor; + divisor = divisor * 10.0; + } + else + { + // handle digits to left of decimal + version *= 10.0; + } + version += addValue; + } + else + { + + if (currChar == '.') + { + // found decimal place + hasDecimal = true; + } + else + { + break; + } + } + // read next char + currIndex++; + } + } + return version; + } + + + public Iterator iterator() + { + return new VIterator(); + } + + private Entry _parseVersion(String value) + { + + int start = 0; + int length = value.length(); + char[] data = new char[length + 1]; + int i = 0; + + value.getChars(0, length, data, 0); + data[length] = (char) 0x1000000; //untype-able ascii char; + char ch = data[i]; + + Entry head, curr; + head = curr = new Entry(); + curr.next = curr; + + while (i < length + 1) + { + //Ignore spaces. TODO: This should happen only for start and end (trim). + while (Character.isSpace(ch)) + ch = data[++i]; + + switch (ch) + { + case '.': + if (start != i) + { + curr.next.text = new String(data, start, i - start); + curr = curr.next; + curr.next = new Entry(); + } + ch = data[++i]; + start = i; + break; + case ((char) 0x1000000): + if (start != i) + { + curr.next.text = new String(data, start, i - start); + curr = curr.next; + curr.next = new Entry(); + } + i++; + break; + default: + ch = data[++i]; + } + } + + curr.next = null; + return head; + } + + private class Entry + { + String text; + Entry next; + } + + private class VIterator implements Iterator + { + public VIterator() + { + _current = _version; + } + + public void remove() + { + throw new UnsupportedOperationException(); + } + + public boolean hasNext() + { + return (null != _current); + } + + public Object next() + { + String part = _current.text; + _current = _current.next; + return part; + } + + private Entry _current; + } + + private String _versionString; + private Entry _version; +} + Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/VersionId.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/XMLConstants.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/XMLConstants.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/XMLConstants.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/XMLConstants.java Mon Jul 24 21:42:41 2006 @@ -13,34 +13,34 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.myfaces.adfinternal.agent.parse; - -/** - * XML Names used in the capabilties file - */ -interface XMLConstants -{ - public static final String NS_URI = "http://myfaces.apache.org/adf/view/faces/agent/capabilities"; - public static final String ELEMENT_ROOT = "capabilitiesDocument"; - public static final String ELEMENT_AGENT_CAPABILITIES = "agentCapabilities"; - public static final String ELEMENT_CAPABILITIES = "capabilities"; - public static final String ELEMENT_INCLUDE = "include"; - public static final String ELEMENT_DEVICES = "devices"; - public static final String ELEMENT_DEVICE = "device"; - public static final String ELEMENT_COMPONENT = "component"; - public static final String ATTRIBUTE_ID = "id"; - public static final String ATTRIBUTE_REFID = "refid"; - public static final String ATTRIBUTE_SRC = "src"; - public static final String ATTRIBUTE_AGENTS = "agents"; - public static final String ATTRIBUTE_PLATFORMS = "platforms"; - public static final String ATTRIBUTE_DEFAULT = "default"; - public static final String ATTRIBUTE_MODEL = "model"; - public static final String ATTRIBUTE_EXTENDS = "extends"; - public static final String ATTRIBUTE_TYPE = "type"; - - public static final String ELEMENT_CAPABILITY_DATA = "capabilityData"; - public static final String ELEMENT_CAPABILITY = "capability"; - public static final String ATTRIBUTE_NAME = "name"; - public static final String ATTRIBUTE_VALUE = "value"; - -} +package org.apache.myfaces.adfinternal.agent.parse; + +/** + * XML Names used in the capabilties file + */ +interface XMLConstants +{ + public static final String NS_URI = "http://myfaces.apache.org/adf/view/faces/agent/capabilities"; + public static final String ELEMENT_ROOT = "capabilitiesDocument"; + public static final String ELEMENT_AGENT_CAPABILITIES = "agentCapabilities"; + public static final String ELEMENT_CAPABILITIES = "capabilities"; + public static final String ELEMENT_INCLUDE = "include"; + public static final String ELEMENT_DEVICES = "devices"; + public static final String ELEMENT_DEVICE = "device"; + public static final String ELEMENT_COMPONENT = "component"; + public static final String ATTRIBUTE_ID = "id"; + public static final String ATTRIBUTE_REFID = "refid"; + public static final String ATTRIBUTE_SRC = "src"; + public static final String ATTRIBUTE_AGENTS = "agents"; + public static final String ATTRIBUTE_PLATFORMS = "platforms"; + public static final String ATTRIBUTE_DEFAULT = "default"; + public static final String ATTRIBUTE_MODEL = "model"; + public static final String ATTRIBUTE_EXTENDS = "extends"; + public static final String ATTRIBUTE_TYPE = "type"; + + public static final String ELEMENT_CAPABILITY_DATA = "capabilityData"; + public static final String ELEMENT_CAPABILITY = "capability"; + public static final String ATTRIBUTE_NAME = "name"; + public static final String ATTRIBUTE_VALUE = "value"; + +} Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/agent/parse/XMLConstants.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/bean/UIXEditableFacesBeanImpl.java URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/bean/UIXEditableFacesBeanImpl.java?rev=425276&r1=425275&r2=425276&view=diff ============================================================================== --- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/bean/UIXEditableFacesBeanImpl.java (original) +++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/bean/UIXEditableFacesBeanImpl.java Mon Jul 24 21:42:41 2006 @@ -1,33 +1,33 @@ -/* - * Copyright 2005,2006 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.myfaces.adfinternal.bean; - -import org.apache.myfaces.adf.bean.PropertyKey; -import org.apache.myfaces.adf.component.UIXEditableValue; - -public class UIXEditableFacesBeanImpl extends UIXFacesBeanImpl -{ - public UIXEditableFacesBeanImpl() - { - } - - public void setProperty(PropertyKey key, Object value) - { - super.setProperty(key, value); - if (key == UIXEditableValue.VALUE_KEY) - setProperty(UIXEditableValue.LOCAL_VALUE_SET_KEY, Boolean.TRUE); - } +/* + * Copyright 2005,2006 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.myfaces.adfinternal.bean; + +import org.apache.myfaces.adf.bean.PropertyKey; +import org.apache.myfaces.adf.component.UIXEditableValue; + +public class UIXEditableFacesBeanImpl extends UIXFacesBeanImpl +{ + public UIXEditableFacesBeanImpl() + { + } + + public void setProperty(PropertyKey key, Object value) + { + super.setProperty(key, value); + if (key == UIXEditableValue.VALUE_KEY) + setProperty(UIXEditableValue.LOCAL_VALUE_SET_KEY, Boolean.TRUE); + } } Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/adfinternal/bean/UIXEditableFacesBeanImpl.java ------------------------------------------------------------------------------ svn:eol-style = native