You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ap...@apache.org on 2009/04/21 12:42:00 UTC
svn commit: r767109 [8/8] - in
/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp: addressing/
authorization/ cryptography/ delivery/ delivery/failure/ modules/
modules/core/base/ modules/core/base/handler/
modules/core/base/handler/async/ modul...
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/ParticleDecoder.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/ParticleDecoder.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/ParticleDecoder.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/ParticleDecoder.java Tue Apr 21 10:41:56 2009
@@ -1,19 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmldecoder;
import org.apache.mina.common.ByteBuffer;
@@ -22,6 +25,9 @@
/**
* partitions the incoming byte stream in particles of XML. either those enclosed by '<' and '>', or the text inbetween.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class ParticleDecoder {
/**
@@ -33,15 +39,15 @@
*/
public static XMLParticle decodeParticle(ByteBuffer byteBuffer, CharsetDecoder charsetDecoder) throws Exception {
int startPosition = byteBuffer.position();
-
+
//String DEBUG_VORDERBAND = byteBuffer.duplicate().getString(charsetDecoder);
if (!byteBuffer.hasRemaining()) return null;
-
+
// count opening and closing braces
char firstChar = (char)byteBuffer.get();
boolean plainText = firstChar != '<';
-
+
boolean endReached = false;
while (byteBuffer.remaining() > 0) {
char aChar = (char)byteBuffer.get();
@@ -58,7 +64,7 @@
// prepare correct slicing
byteBuffer.position(startPosition);
byteBuffer.limit(endPosition);
- stanzaBuffer = byteBuffer.slice();
+ stanzaBuffer = byteBuffer.slice();
} finally {
// cut off sliced parts
byteBuffer.position(endPosition);
@@ -74,5 +80,5 @@
byteBuffer.position(startPosition);
return null;
}
-
+
}
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/UnsupportedXMLException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/UnsupportedXMLException.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/UnsupportedXMLException.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/UnsupportedXMLException.java Tue Apr 21 10:41:56 2009
@@ -1,24 +1,30 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmldecoder;
/**
* some valid XML is unsupported in XMPP. see RFC3920/11.
* this exception signals XML, which might be valid, but is unsupported by our parser
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class UnsupportedXMLException extends DecodingException {
public UnsupportedXMLException() {
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLParticle.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLParticle.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLParticle.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLParticle.java Tue Apr 21 10:41:56 2009
@@ -1,19 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmldecoder;
import java.util.regex.Matcher;
@@ -21,13 +24,16 @@
/**
* holds a particle of XML, either representing an start or end element, or an elements body, or other text nodes.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class XMLParticle {
-
+
private boolean isOpeningElement = false;
private boolean isClosingElement = false;
private boolean isSpecialElement = false;
-
+
String elementName = null;
String content = null;
public static final String ELEMENT_OPEN = "<";
@@ -57,7 +63,7 @@
isSpecialElement = true;
isOpeningElement = true;
isClosingElement = true;
- }
+ }
}
}
@@ -110,7 +116,7 @@
elementName = matcher.group(1);
return elementName;
}
-
+
public String parseElementName() throws DecodingException {
StringBuilder elementNameBuilder = new StringBuilder();
boolean beforeElement = true;
@@ -125,7 +131,7 @@
if (beforeElement) {
if (!isLegitemateNameStartChar(current)) {
throw new DecodingException("cannot start element name with char " + (char)current);
- }
+ }
beforeElement = false;
} else {
if (!isLegitemateNameChar(current)) {
@@ -148,7 +154,7 @@
}
/**
- *
+ *
* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
* @param c
* @return
@@ -156,9 +162,9 @@
private boolean isLegitemateNameChar(int c) {
return isLegitemateNameStartChar(c) || Character.isDigit(c) || c == '.' || c == '-';
}
-
+
private boolean isLegitemateNameStartChar(int c) {
- return Character.isLetter(c) || c == '_' || c == ':';
+ return Character.isLetter(c) || c == '_' || c == ':';
}
-
+
}
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLRawToFragmentConverter.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLRawToFragmentConverter.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLRawToFragmentConverter.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmldecoder/XMLRawToFragmentConverter.java Tue Apr 21 10:41:56 2009
@@ -1,19 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmldecoder;
import org.apache.vysper.xmpp.stanza.Stanza;
@@ -29,6 +32,9 @@
/**
* determines, if a sequence of XMLParticles is balanced, and if it is, converts them to XMLFragments (which are understood
* by core XMPP engine.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class XMLRawToFragmentConverter {
private static final String CHAR_ATTR_EQUALS = "=";
@@ -41,22 +47,22 @@
enum AttributeParseState {
BEFORE_KEY, IN_KEY, BEFORE_EQUALS, BEFORE_VALUE, IN_VALUE
}
-
+
public boolean isBalanced(List<XMLParticle> particles) throws DecodingException {
// stack, where opened elements are pushed and closing are pulled
Stack<XMLParticle> openedElements = new Stack<XMLParticle>();
-
+
for (XMLParticle particle : particles) {
if (particle.isSpecialElement()) {
- continue; // special elements do not have nested elements
+ continue; // special elements do not have nested elements
} else if (particle.isOpeningOnlyElement()) {
openedElements.push(particle);
} else if (particle.isText()) {
- continue; // text does not have nested elements
+ continue; // text does not have nested elements
} else if (particle.isOpeningElement()) {
// is also closing (because opening-only are already handled),
- // so don't push them
+ // so don't push them
continue;
} else if (particle.isClosingElement()) {
// TODO handle </stream:stream> here as a special case
@@ -71,13 +77,13 @@
boolean startOfStream = (openedElements.size() == 1 && openedElements.get(0).getElementName().equals("stream:stream"));
return openedElements.isEmpty() || startOfStream;
}
-
+
public XMLFragment convert(List<XMLParticle> particles) throws DecodingException {
List<XMLFragment> xmlFragmentList = convert(particles, null);
if (xmlFragmentList.size() != 1) throw new DecodingException("converter only allows for one top xml element, all others must be inner elements");
return xmlFragmentList.get(0);
}
-
+
protected List<XMLFragment> convert(List<XMLParticle> particles, String stopElementName) throws DecodingException {
boolean createStanza = stopElementName == null;
@@ -88,8 +94,8 @@
if (particle.isOpeningElement() && particle.getContent().startsWith("<!--")) {
throw new UnsupportedXMLException("XML comments are unsupported in XMPP");
- }
-
+ }
+
if (particle.isOpeningElement() && particle.isClosingElement()) {
// has no inner elements, no need to find matching closer
XMLElement completeElement = getElementForOpening(particle, createStanza);
@@ -107,8 +113,8 @@
else throw new DecodingException("closing xml elements mismatch. expected '" + stopElementName + "' but found '" + closingElementName + "'");
} else {
fragments.add(new XMLText(particle.getContent()));
- }
-
+ }
+
}
if (stopElementName != null) {
// of the remaining elements, all must be texts
@@ -146,7 +152,7 @@
if (i >= 1) {
namespace = elementName.substring(i+1);
elementName = elementName.substring(0, i);
- if ("".equals(namespace) || "".equals(elementName)) throw new DecodingException("illegal element name " + namespace + ":" + elementName);
+ if ("".equals(namespace) || "".equals(elementName)) throw new DecodingException("illegal element name " + namespace + ":" + elementName);
} else if (i == 0) {
// element something like "<:foo> this is legal XML. in this case, acccording to XML spec section 2.3,
// the colon belongs to the element name and is not a separator for the namespace.
@@ -171,7 +177,7 @@
if (aChar == '<') throw new DecodingException("illegal opening brace inside xml element: " + content);
stack.push(aChar);
}
-
+
String key = null;
String value = null;
StringBuilder collect = null;
@@ -183,7 +189,7 @@
if (currentState == AttributeParseState.BEFORE_KEY) return attributes;
else return null; // we are in the middle of something
}
-
+
switch (currentState) {
case BEFORE_EQUALS:
if (Character.isWhitespace(character)) stack.pop();
@@ -211,7 +217,7 @@
collect = new StringBuilder();
collect.append(character);
stack.pop();
- }
+ }
break;
case BEFORE_VALUE:
if (Character.isWhitespace(character)) stack.pop();
@@ -244,7 +250,7 @@
attributes.add(new Attribute(key, value));
}
break;
- }
+ }
}
return attributes;
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Attribute.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Attribute.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Attribute.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Attribute.java Tue Apr 21 10:41:56 2009
@@ -1,24 +1,29 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
-
+/*
+ * 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.vysper.xmpp.xmlfragment;
/**
* represents an XML element's attribute
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class Attribute {
private String name;
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/EqualityVerifier.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/EqualityVerifier.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/EqualityVerifier.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/EqualityVerifier.java Tue Apr 21 10:41:56 2009
@@ -1,19 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
import java.util.Comparator;
@@ -21,6 +24,9 @@
import java.util.List;
/**
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class EqualityVerifier {
@@ -33,7 +39,7 @@
public boolean equalsElements_Shallow(XMLElement first, XMLElement second) {
if (first == null) return second == null;
if (second == null) return false;
-
+
if (!first.getName().equals(second.getName())) return false;
if (!first.getNamespace().equals(second.getNamespace())) return false;
@@ -43,12 +49,12 @@
/**
* additional to the shallow check, does check the inner elements. more precisely, it checks whether
* all inner elements at corresponding positions are equal. it does _not_ check whether inner elements
- * are the same for some proper mutation.
+ * are the same for some proper mutation.
*/
public boolean equalsElements_DeepSameOrder(XMLElement first, XMLElement second) {
if (first == null) return second == null;
if (second == null) return false;
-
+
if (!first.getName().equals(second.getName())) return false;
if (!first.getNamespace().equals(second.getNamespace())) return false;
@@ -57,7 +63,7 @@
List<XMLElement> firstInnerElements = first.getInnerElements();
List<XMLElement> secondInnerElements = second.getInnerElements();
-
+
if (firstInnerElements.size() != secondInnerElements.size()) return false;
for (int i = 0; i < firstInnerElements.size(); i++) {
if (!equalsElements_DeepSameOrder(firstInnerElements.get(0), secondInnerElements.get(0))) return false;
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/FragmentFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/FragmentFactory.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/FragmentFactory.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/FragmentFactory.java Tue Apr 21 10:41:56 2009
@@ -1,20 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
-
+/*
+ * 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.vysper.xmpp.xmlfragment;
import java.util.ArrayList;
@@ -23,6 +25,9 @@
/**
* convenience methods for creating XML fragments
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class FragmentFactory {
public static XMLElement createElementWithInnerText(String name, String text) {
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/NamespaceAttribute.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/NamespaceAttribute.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/NamespaceAttribute.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/NamespaceAttribute.java Tue Apr 21 10:41:56 2009
@@ -1,23 +1,29 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
/**
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class NamespaceAttribute extends Attribute {
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Renderer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Renderer.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Renderer.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/Renderer.java Tue Apr 21 10:41:56 2009
@@ -1,24 +1,30 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
/**
* TODO support namespaces (inherited from outer/inheriting for inner elements)
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class Renderer {
@@ -78,7 +84,7 @@
}
private void renderElementName(StringBuilder buffer, XMLElement element, String namespace, String name) {
- // if the element has a namespace prefix, retrieves the prefix from the defining attribute
+ // if the element has a namespace prefix, retrieves the prefix from the defining attribute
if (namespace != null) {
String namespaceIdentifier = element.getVerifier().getNamespaceIdentifier(namespace);
if (namespaceIdentifier != null) {
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElement.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElement.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElement.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElement.java Tue Apr 21 10:41:56 2009
@@ -1,19 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
@@ -26,6 +29,9 @@
/**
* an immutable xml element specialized for XMPP.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class XMLElement implements XMLFragment {
@@ -35,10 +41,10 @@
* example element: <a:b xmlns:a="http://ns.org" >
* element's namespace. the prefix for the element name is taken from the corresponding attribute.
* if the namespace is 'http://ns.org', then element name b is prefixed with a.
- * NOTE: the namespace value must NOT be "b"!
+ * NOTE: the namespace value must NOT be "b"!
*/
private String namespace;
-
+
private List<Attribute> attributes;
private List<XMLFragment> innerFragments;
protected XMLElementVerifier xmlElementVerifier;
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java Tue Apr 21 10:41:56 2009
@@ -1,19 +1,22 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
@@ -22,8 +25,11 @@
/**
* provides common tools to check a element against its specification or
* semantical context this classes instances are immutual.
- *
+ *
* TODO add unit test
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class XMLElementVerifier {
protected XMLElement element;
@@ -44,7 +50,7 @@
/**
* Checks whether all given attributes are present on the element.
- *
+ *
* @param names
* the attributes to check
* @return true iff all attributes are present, false otherwise
@@ -63,7 +69,7 @@
/**
* Checks whether only the given attributes are present on the element.
- *
+ *
* @param names
* the attributes to check
* @return true iff only the given attributes are present, false otherwise
@@ -78,7 +84,7 @@
/**
* Checks whether any of the given attributes are present on the element.
- *
+ *
* @param names
* the attributes to check
* @return true iff at least one of the given attributes is present, false
@@ -137,7 +143,7 @@
/**
* example for "http://myNS.org/anything", this method returns "myNS" for
* element <test xmlns:myNS="http://myNS.org/anything" />
- *
+ *
* @return the identifier for the given namespace definition
*/
public String getNamespaceIdentifier(String namespace) {
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLFragment.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLFragment.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLFragment.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLFragment.java Tue Apr 21 10:41:56 2009
@@ -1,23 +1,29 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
/**
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public interface XMLFragment {
}
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLSemanticError.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLSemanticError.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLSemanticError.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLSemanticError.java Tue Apr 21 10:41:56 2009
@@ -1,24 +1,29 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
+/*
+ * 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.vysper.xmpp.xmlfragment;
/**
* the XML was syntactically ok, but business logic applied on xml level revealed semantical problems
* (wrong attributes, doubled elements etc.)
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class XMLSemanticError extends Exception {
public XMLSemanticError() {
Modified: mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLText.java
URL: http://svn.apache.org/viewvc/mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLText.java?rev=767109&r1=767108&r2=767109&view=diff
==============================================================================
--- mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLText.java (original)
+++ mina/sandbox/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLText.java Tue Apr 21 10:41:56 2009
@@ -1,24 +1,29 @@
-/***********************************************************************
- * Copyright (c) 2006-2007 The Apache Software Foundation. *
- * All rights reserved. *
- * ------------------------------------------------------------------- *
- * 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. *
- ***********************************************************************/
-
+/*
+ * 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.vysper.xmpp.xmlfragment;
/**
* immutable text section (as it can appear between two xml elements
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Revision$ , $Date: 2009-04-21 13:13:19 +0530 (Tue, 21 Apr 2009) $
*/
public class XMLText implements XMLFragment {
private String text;