You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2011/07/23 16:03:07 UTC
svn commit: r1150107 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/
Author: martinkoci
Date: Sat Jul 23 14:03:05 2011
New Revision: 1150107
URL: http://svn.apache.org/viewvc?rev=1150107&view=rev
Log:
MYFACES-3221 Create and use structure for facelets Location and TagAttribute-aware exceptions
Added:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/ComponentAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAndTagAttributeAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogKeyAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogMessageAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAttributeAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAware.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/package.html
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/ComponentAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/ComponentAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/ComponentAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/ComponentAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.debug;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * Identification inferface for types that know about {@link UIComponent}.
+ *
+ * @author martinkoci
+ */
+public interface ComponentAware {
+
+ UIComponent getComponent();
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAndTagAttributeAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAndTagAttributeAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAndTagAttributeAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAndTagAttributeAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.debug;
+
+import javax.el.Expression;
+import javax.faces.view.Location;
+import javax.faces.view.facelets.TagAttribute;
+
+
+/**
+ * Identification inferface for types that know about {@link Location} and XML attribute name/value pair.
+ *
+ * <ol>
+ * <li>Location - location instance - see {@link LocationAware}</li>
+ * <li>expressionString - expression String {@link Expression#getExpressionString()}</li>
+ * <li>qName - the qualified name for attribute {@link TagAttribute#getQName()}</li>
+ * </ol>
+ *
+ * If type implements this interface, we can say that it knows where instance implementing this interface is located in facelets view (line/column)
+ * and what XML attribute (name/value pair) makes it.
+ *
+ * Also you can think about this type as about ligthweight version of {@link TagAttributeAware} for cases, where full TagAttribute instance is not available
+ *
+ * @author martinkoci
+ */
+public interface LocationAndTagAttributeAware extends LocationAware {
+
+
+ /**
+ * @return expression string, for example "#{bean.actionMethod}" or "success"
+ */
+ public abstract String getExpressionString();
+
+ /**
+ * @return qName of XML attribute, for example "action" or "value"
+ */
+ public abstract String getQName();
+
+}
\ No newline at end of file
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/LocationAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,42 @@
+/*
+ * 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.debug;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.Location;
+
+/**
+ * Identification inferface for types that know about {@link Location}.
+ *
+ * If type implements this interface, we can say that it knows where instance implementing this interfaces is located in facelets view.
+ *
+ * {@link UIComponent} is LocationAware-like, because it knows it's Location: {@link UIComponent#VIEW_LOCATION_KEY}
+ *
+ * @author martinkoci
+ *
+ * @see Location
+ */
+public interface LocationAware {
+
+ /**
+ * @return the {@link Location} instance where this object exists/is related to
+ */
+ Location getLocation();
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogKeyAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogKeyAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogKeyAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogKeyAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,34 @@
+/*
+ * 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.debug;
+
+import org.apache.myfaces.logging.MyfacesLogKey;
+
+/**
+ * Identification inferface for types that know about {@link MyfacesLogKey}.
+ *
+ * @author martinkoci
+ *
+ * @see MyfacesLogKey
+ */
+public interface MyfacesLogKeyAware {
+
+ MyfacesLogKey getMyfacesLogKey();
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogMessageAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogMessageAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogMessageAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/MyfacesLogMessageAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,34 @@
+/*
+ * 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.debug;
+
+import org.apache.myfaces.logging.MyfacesLogMessage;
+
+/**
+ * Identification inferface for types that know about {@link MyfacesLogMessage}.
+ *
+ * @author martinkoci
+ *
+ * @see MyfacesLogMessage
+ */
+public interface MyfacesLogMessageAware {
+
+ MyfacesLogMessage getMyfacesLogMessage();
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAttributeAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAttributeAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAttributeAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAttributeAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,34 @@
+/*
+ * 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.debug;
+
+import javax.faces.view.facelets.TagAttribute;
+
+/**
+ * Identification inferface for types that know about {@link TagAttribute}. from facelets view.
+ *
+ * @author martinkoci
+ *
+ * @see TagAttribute
+ */
+public interface TagAttributeAware {
+
+ TagAttribute getTagAttribute();
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAware.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAware.java?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAware.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/TagAware.java Sat Jul 23 14:03:05 2011
@@ -0,0 +1,34 @@
+/*
+ * 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.debug;
+
+import javax.faces.view.facelets.Tag;
+
+/**
+ * Identification inferface for types that know about {@link Tag}. from facelets view.
+ *
+ * @author martinkoci
+ *
+ * @see Tag
+ */
+public interface TagAware {
+
+ Tag getTag();
+
+}
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/package.html
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/package.html?rev=1150107&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/package.html (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/debug/package.html Sat Jul 23 14:03:05 2011
@@ -0,0 +1,43 @@
+<html>
+<head><!--
+ 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.
+
+ $Id: package.html,v 1.3 2008/07/13 19:01:52 rlubke Exp $
+--></head>
+<body>
+<p>
+ This package defines types for myfaces debuggging (not Myfaces itself but facelets files, Myfaces lifecycle etc.)
+
+ <h5>Purpose of <code>Aware</code> interfaces</h5>
+ <p>Identify object that are capable to "know something" about important classes in JSF/Myfaces.
+
+ <p>For example, the most important type in JSF is UIComponent -> ComponentAware; In Facelets Location (line/column in facelets file) is important -> LocationAware.</p>
+
+ <p><b>Example of usage</b>. JSF/myfaces code throw many different kinds of exceptions. In exception handlig code client can use instanceof
+
+ <pre>
+ if (e instanceof ComponentAware)
+ {
+ ComponentAware componentAware = (ComponentAware) e;
+ }</pre>
+
+ <p>to check if info about component is available. </p>
+
+ <i>Note</i>: there is a <code>Aware</code> interface for each important type. Have all information in one big interface is not suitable, because we need to distinguish in client code:
+ <ol>
+ <li>if type is capable of knowing (with instanceof)</li>
+ <li>if instance has that information (componentAware.getComponent() != null)</li>
+ </ol>
+</p>
+</body>
+</html>