myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckor...@apache.org
Subject svn commit: r820386 [2/2] - in /myfaces/commons/trunk: ./ myfaces-commons-agent/ myfaces-commons-agent/src/ myfaces-commons-agent/src/main/ myfaces-commons-agent/src/main/java/ myfaces-commons-agent/src/main/java/org/ myfaces-commons-agent/src/main/jav...
Date Wed, 30 Sep 2009 18:54:22 GMT
Added: myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java?rev=820386&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java
(added)
+++ myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java
Wed Sep 30 18:54:21 2009
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.commons.agent.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.myfaces.commons.agent.Agent;
+import org.apache.myfaces.commons.agent.CapabilityKey;
+
+import static org.apache.myfaces.commons.agent.AgentConstants.*;
+
+/**
+ * The implementation of agent interface
+ * <p>
+ * </p>
+ * This implementation supports agents recognized by all uix22 This class
+ * returns name strings (instead of int's) Certain agents/platforms have been
+ * renamed - using "webkit" (instead of safari), on recommendation from uix team
+ * - using "gecko" for all gecko based browsers - using "ppc" (instead of
+ * windows) for platform
+ * <p>
+ * </p>
+ */
+public class AgentImpl implements Agent {
+
+    public AgentImpl() {
+        _entry = new AgentEntry();
+    }
+
+    /*
+      * public AgentImpl(String userAgent, String accept) { _entry =
+      * _getAgentEntry(userAgent, accept); }
+      */
+    public String getType() {
+        return _entry._type;
+    }
+
+    public String getAgentName() {
+        return _entry._agent;
+    }
+
+    public String getAgentVersion() {
+        return _entry._agentVersion;
+    }
+
+    public String getPlatformName() {
+        return _entry._platform;
+    }
+
+    public String getPlatformVersion() {
+        return _entry._platformVersion;
+    }
+
+    public String getHardwareMakeModel() {
+        return _entry._makeModel;
+    }
+
+    public Map<Object, Object> getCapabilities() {
+        return _requestCapabilities;
+    }
+
+    // setter methods for AgentImpl
+    public void setType(String type) {
+        _entry._type = type;
+    }
+
+    public void setAgent(String agent) {
+        _entry._agent = agent;
+    }
+
+    public void setAgentVersion(String version) {
+        _entry._agentVersion = version;
+    }
+
+    public void setPlatform(String platform) {
+        _entry._platform = platform;
+    }
+
+    public void setPlatformVersion(String version) {
+        _entry._platformVersion = version;
+    }
+
+    public void setMakeModel(String makemodel) {
+        _entry._makeModel = makemodel;
+    }
+
+    // Private entry structure to
+    // store the Agent attributes
+    private static class AgentEntry {
+        String _type = UNKNOWN;
+        String _agent;
+        String _agentVersion;
+        String _platform;
+        String _platformVersion;
+        String _makeModel;
+    }
+
+    void __addRequestCapability(CapabilityKey key, Object value) {
+        if (_requestCapabilities == null) {
+            _requestCapabilities = new HashMap<Object, Object>();
+        }
+        _requestCapabilities.put(key, value);
+    }
+
+    private HashMap<Object, Object> _requestCapabilities;
+    private AgentEntry _entry;
+}

Propchange: myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/commons/trunk/myfaces-commons-agent/src/main/java/org/apache/myfaces/commons/agent/impl/AgentImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/commons/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/pom.xml?rev=820386&r1=820385&r2=820386&view=diff
==============================================================================
--- myfaces/commons/trunk/pom.xml (original)
+++ myfaces/commons/trunk/pom.xml Wed Sep 30 18:54:21 2009
@@ -276,6 +276,7 @@
         <module>myfaces-commons-components</module>
         <module>myfaces-commons-examples</module>
         <module>myfaces-commons-facelets-examples</module>
+		<module>myfaces-commons-agent</module>
     </modules>
 
     <profiles>



Mime
View raw message