index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/StartDocument.java | /*
**
** 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 javax.xml.stream.events;
public interface StartDocument extends XMLEvent {
public boolean encodingSet();
public String getCharacterEncodingScheme();
public String getSystemId();
public String getVersion();
public boolean isStandalone();
public boolean standaloneSet();
} | 600 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/Namespace.java | /*
**
** 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 javax.xml.stream.events;
public interface Namespace extends Attribute {
public String getNamespaceURI();
public String getPrefix();
public boolean isDefaultNamespaceDeclaration();
} | 601 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/NotationDeclaration.java | /*
**
** 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 javax.xml.stream.events;
public interface NotationDeclaration extends XMLEvent {
public String getName();
public String getPublicId();
public String getSystemId();
} | 602 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/EndElement.java | /*
**
** 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 javax.xml.stream.events;
import java.util.Iterator;
import javax.xml.namespace.QName;
public interface EndElement extends XMLEvent {
public QName getName();
public Iterator getNamespaces();
} | 603 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/StartElement.java | /*
**
** 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 javax.xml.stream.events;
import java.util.Iterator;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
public interface StartElement extends XMLEvent {
public Attribute getAttributeByName(QName name);
public Iterator getAttributes();
public QName getName();
public NamespaceContext getNamespaceContext();
public Iterator getNamespaces();
public String getNamespaceURI(String prefix);
} | 604 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/EntityReference.java | /*
**
** 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 javax.xml.stream.events;
public interface EntityReference extends XMLEvent {
public EntityDeclaration getDeclaration();
public String getName();
} | 605 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/Comment.java | /*
**
** 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 javax.xml.stream.events;
public interface Comment extends XMLEvent {
public String getText();
} | 606 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/Characters.java | /*
**
** 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 javax.xml.stream.events;
public interface Characters extends XMLEvent {
public String getData();
public boolean isCData();
public boolean isIgnorableWhiteSpace();
public boolean isWhiteSpace();
} | 607 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/EndDocument.java | /*
**
** 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 javax.xml.stream.events;
public interface EndDocument extends XMLEvent {
} | 608 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/XMLEvent.java | /*
**
** 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 javax.xml.stream.events;
import java.io.Writer;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
public interface XMLEvent extends XMLStreamConstants {
public Characters asCharacters();
public EndElement asEndElement();
public StartElement asStartElement();
public int getEventType();
public Location getLocation();
public QName getSchemaType();
public boolean isAttribute();
public boolean isCharacters();
public boolean isEndDocument();
public boolean isEndElement();
public boolean isEntityReference();
public boolean isNamespace();
public boolean isProcessingInstruction();
public boolean isStartDocument();
public boolean isStartElement();
public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException;
} | 609 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/Attribute.java | /*
**
** 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 javax.xml.stream.events;
import javax.xml.namespace.QName;
public interface Attribute extends XMLEvent {
public String getDTDType();
public QName getName();
public String getValue();
public boolean isSpecified();
} | 610 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/ProcessingInstruction.java | /*
**
** 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 javax.xml.stream.events;
public interface ProcessingInstruction extends XMLEvent {
public String getData();
public String getTarget();
} | 611 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/stream/events/EntityDeclaration.java | /*
**
** 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 javax.xml.stream.events;
public interface EntityDeclaration extends XMLEvent {
public String getBaseURI();
public String getName();
public String getNotationName();
public String getPublicId();
public String getReplacementText();
public String getSystemId();
} | 612 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/namespace/NamespaceContext.java | /*
**
** 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 javax.xml.namespace;
import java.util.Iterator;
public interface NamespaceContext {
public String getNamespaceURI(String prefix);
public String getPrefix(String namespaceURI);
public Iterator getPrefixes(String namespaceURI);
} | 613 |
0 | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml | Create_ds/geronimo-specs/geronimo-stax-api_1.0_spec/src/main/java/javax/xml/namespace/QName.java | /*
**
** 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 javax.xml.namespace;
import java.io.Serializable;
import javax.xml.XMLConstants;
public class QName implements Serializable {
// not specified in the javadoc, but this is what appears to be used.
private static final long serialVersionUID = -9120448754896609940L;
// the namespace URI of this qualified name
private final String namespaceURI;
// the local part of the name
private final String localPart;
// the name prefix string
private final String prefix;
public QName(String localPart) {
// default both the URI and the prefix
this("", localPart, XMLConstants.DEFAULT_NS_PREFIX);
}
public QName(String namespaceURI, String localPart) {
// the default prefix is defined in XMLConstants
this(namespaceURI, localPart, XMLConstants.DEFAULT_NS_PREFIX);
}
public QName(String namespaceURI, String localPart, String prefix) {
// there is a default in constants as well
this.namespaceURI = namespaceURI == null ? "" : namespaceURI;
// both the local part and the prefix are required
if (localPart == null) {
throw new IllegalArgumentException("local part is required when creating a QName");
}
this.localPart = localPart;
if (prefix == null) {
throw new IllegalArgumentException("prefix is required when creating a QName");
}
this.prefix = prefix;
}
public final boolean equals(Object other) {
if (other == null || !(other instanceof QName)) {
return false;
}
QName qName = (QName)other;
// only the namespace and localPart are considered. the prefix is not used.
return namespaceURI.equals(qName.namespaceURI) && localPart.equals(qName.localPart);
}
public final int hashCode() {
// uses both the namespace and localpart as a combined hash.
return namespaceURI.hashCode() ^ localPart.hashCode();
}
public String getNamespaceURI() {
return namespaceURI;
}
public String getLocalPart() {
return localPart;
}
public String getPrefix() {
return prefix;
}
public String toString() {
// if no real URI, this is just the local part, otherwise
// use the braces syntax.
if (namespaceURI.length() == 0) {
return localPart;
}
else {
return "{" + namespaceURI + "}" + localPart;
}
}
public static QName valueOf(String source) {
// a name is required
if (source == null) {
throw new IllegalArgumentException("source QName string is required");
}
// if this is a null string or it does not start with '{', treat this
// as a local part alone.
if (source.length() == 0 || source.charAt(0) != '{') {
return new QName(source);
}
// Namespace URI and local part specified
int uriEnd = source.indexOf('}');
if (uriEnd == -1) {
throw new IllegalArgumentException("Incorrect QName syntax: " + source);
}
String uri = source.substring(1, uriEnd);
if (uri.length() == 0) {
throw new IllegalArgumentException("Null namespace URI in QName value: " + source);
}
// no prefix possible here, just the URI and the local part
return new QName(uri, source.substring(uriEnd + 1));
}
}
| 614 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/CommandInfoTest.java | /**
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.activation;
import java.io.IOException;
import junit.framework.TestCase;
/**
* @version $Rev$ $Date$
*/
public class CommandInfoTest extends TestCase {
public void testAttributes() {
CommandInfo info = new CommandInfo("test", "test.class");
assertEquals("test", info.getCommandName());
assertEquals("test.class", info.getCommandClass());
}
public void testInvalidClassName() throws IOException {
CommandInfo info = new CommandInfo("test", "test.class");
try {
info.getCommandObject(null, null);
fail("Expected ClassNotFoundException");
} catch (ClassNotFoundException e) {
// ok
}
}
public void testCommandObject() throws IOException, ClassNotFoundException {
CommandInfo info = new CommandInfo("test", MockCommandObject.class.getName());
DataHandler dh = new DataHandler("Hello", "text/plain");
Object o = info.getCommandObject(dh, MockCommandObject.class.getClassLoader());
assertTrue(o instanceof MockCommandObject);
MockCommandObject bean = (MockCommandObject) o;
assertEquals("test", bean.verb);
assertSame(dh, bean.dh);
}
public static class MockCommandObject implements CommandObject {
private String verb;
private DataHandler dh;
public void setCommandContext(String verb, DataHandler dh) {
this.verb = verb;
this.dh = dh;
}
}
}
| 615 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/MimeTypeTest.java | /**
* 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 javax.activation;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import junit.framework.TestCase;
/**
*
* @version $Rev$ $Date$
*/
public class MimeTypeTest extends TestCase {
private MimeType mimeType;
public MimeTypeTest(String name) {
super(name);
}
public void setUp() throws Exception {
super.setUp();
mimeType = new MimeType();
}
public void testDefaultConstructor() throws MimeTypeParseException {
assertEquals("application/*", mimeType.getBaseType());
assertEquals("application", mimeType.getPrimaryType());
// not sure as RFC2045 does not allow "*" but this is what the RI does
assertEquals("*", mimeType.getSubType());
assertTrue(mimeType.match(new MimeType()));
assertTrue(mimeType.match(new MimeType("application/*")));
assertNull(mimeType.getParameter("foo"));
assertEquals(0, mimeType.getParameters().size());
assertTrue(mimeType.getParameters().isEmpty());
}
public void testMimeTypeConstructor() throws MimeTypeParseException {
mimeType = new MimeType("text/plain");
assertEquals("text/plain", mimeType.getBaseType());
assertEquals("text", mimeType.getPrimaryType());
assertEquals("plain", mimeType.getSubType());
assertEquals("text/plain", mimeType.toString());
}
public void testTypeConstructor() throws MimeTypeParseException {
mimeType = new MimeType("text", "plain");
assertEquals("text/plain", mimeType.getBaseType());
assertEquals("text", mimeType.getPrimaryType());
assertEquals("plain", mimeType.getSubType());
assertEquals("text/plain", mimeType.toString());
}
public void testConstructorWithParams() throws MimeTypeParseException {
mimeType = new MimeType("text/plain; charset=\"iso-8859-1\"");
assertEquals("text/plain", mimeType.getBaseType());
assertEquals("text", mimeType.getPrimaryType());
assertEquals("plain", mimeType.getSubType());
MimeTypeParameterList params = mimeType.getParameters();
assertEquals(1, params.size());
assertEquals("iso-8859-1", params.get("charset"));
assertEquals("text/plain; charset=iso-8859-1", mimeType.toString());
}
public void testConstructorWithQuotableParams() throws MimeTypeParseException {
mimeType = new MimeType("text/plain; charset=\"iso(8859)\"");
assertEquals("text/plain", mimeType.getBaseType());
assertEquals("text", mimeType.getPrimaryType());
assertEquals("plain", mimeType.getSubType());
MimeTypeParameterList params = mimeType.getParameters();
assertEquals(1, params.size());
assertEquals("iso(8859)", params.get("charset"));
assertEquals("text/plain; charset=\"iso(8859)\"", mimeType.toString());
}
public void testWriteExternal() throws MimeTypeParseException, IOException {
mimeType = new MimeType("text/plain; charset=iso8859-1");
mimeType.writeExternal(new ObjectOutput() {
public void writeUTF(String str) {
assertEquals("text/plain; charset=iso8859-1", str);
}
public void close() {
fail();
}
public void flush() {
}
public void write(int b) {
fail();
}
public void write(byte b[]) {
fail();
}
public void write(byte b[], int off, int len) {
fail();
}
public void writeObject(Object obj) {
fail();
}
public void writeDouble(double v) {
fail();
}
public void writeFloat(float v) {
fail();
}
public void writeByte(int v) {
fail();
}
public void writeChar(int v) {
fail();
}
public void writeInt(int v) {
fail();
}
public void writeShort(int v) {
fail();
}
public void writeLong(long v) {
fail();
}
public void writeBoolean(boolean v) {
fail();
}
public void writeBytes(String s) {
fail();
}
public void writeChars(String s){
fail();
}
});
}
public void testReadExternal() throws IOException, ClassNotFoundException {
mimeType.readExternal(new ObjectInput() {
public String readUTF() {
return "text/plain; charset=iso-8859-1";
}
public int available() {
fail();
throw new AssertionError();
}
public int read() {
fail();
throw new AssertionError();
}
public void close() {
fail();
throw new AssertionError();
}
public long skip(long n) {
fail();
throw new AssertionError();
}
public int read(byte b[]) {
fail();
throw new AssertionError();
}
public int read(byte b[], int off, int len) {
fail();
throw new AssertionError();
}
public Object readObject() {
fail();
throw new AssertionError();
}
public byte readByte() {
fail();
throw new AssertionError();
}
public char readChar() {
fail();
throw new AssertionError();
}
public double readDouble() {
fail();
throw new AssertionError();
}
public float readFloat() {
fail();
throw new AssertionError();
}
public int readInt() {
fail();
throw new AssertionError();
}
public int readUnsignedByte() {
fail();
throw new AssertionError();
}
public int readUnsignedShort() {
fail();
throw new AssertionError();
}
public long readLong() {
fail();
throw new AssertionError();
}
public short readShort() {
fail();
throw new AssertionError();
}
public boolean readBoolean() {
fail();
throw new AssertionError();
}
public int skipBytes(int n) {
fail();
throw new AssertionError();
}
public void readFully(byte b[]) {
fail();
}
public void readFully(byte b[], int off, int len) {
fail();
}
public String readLine() {
fail();
throw new AssertionError();
}
});
assertEquals("text/plain", mimeType.getBaseType());
assertEquals("text", mimeType.getPrimaryType());
assertEquals("plain", mimeType.getSubType());
MimeTypeParameterList params = mimeType.getParameters();
assertEquals(1, params.size());
assertEquals("iso-8859-1", params.get("charset"));
assertEquals("text/plain; charset=iso-8859-1", mimeType.toString());
}
}
| 616 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/MimeTypeParameterListTest.java | /**
* 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 javax.activation;
import java.util.Enumeration;
import junit.framework.TestCase;
/**
*
* @version $Rev$ $Date$
*/
public class MimeTypeParameterListTest extends TestCase {
public void testEmptyParameterList() {
MimeTypeParameterList parameterList = new MimeTypeParameterList();
assertEquals(0, parameterList.size());
assertTrue(parameterList.isEmpty());
}
public void testSimpleParameterList() throws MimeTypeParseException {
MimeTypeParameterList parameterList = new MimeTypeParameterList(";name=value");
assertEquals(1, parameterList.size());
assertFalse(parameterList.isEmpty());
Enumeration e = parameterList.getNames();
assertTrue(e.hasMoreElements());
assertEquals("name", e.nextElement());
assertFalse(e.hasMoreElements());
assertEquals("value", parameterList.get("name"));
}
public void testQuotedValue() throws MimeTypeParseException {
MimeTypeParameterList parameterList = new MimeTypeParameterList(";name=\"val()ue\"");
assertEquals(1, parameterList.size());
assertEquals("val()ue", parameterList.get("name"));
}
public void testWhiteSpacesParameterList() throws MimeTypeParseException {
MimeTypeParameterList parameterList = new MimeTypeParameterList("; name= value");
assertEquals(1, parameterList.size());
assertEquals("name", parameterList.getNames().nextElement());
assertEquals("value", parameterList.get("name"));
}
public void testLongParameterList() throws MimeTypeParseException {
MimeTypeParameterList parameterList = new MimeTypeParameterList(";name1=value1; name2 = value2; name3=value3;name4 = value4");
assertEquals(4, parameterList.size());
assertEquals("value1", parameterList.get("name1"));
assertEquals("value2", parameterList.get("name2"));
assertEquals("value3", parameterList.get("name3"));
assertEquals("value4", parameterList.get("name4"));
}
public void testCaseInsensitivity() throws MimeTypeParseException {
MimeTypeParameterList parameterList = new MimeTypeParameterList(";name1=value; NAME2=VALUE; NaMe3=VaLuE");
assertEquals(3, parameterList.size());
assertEquals("value", parameterList.get("name1"));
assertEquals("VALUE", parameterList.get("name2"));
assertEquals("VaLuE", parameterList.get("name3"));
assertEquals("value", parameterList.get("NAME1"));
assertEquals("value", parameterList.get("NaMe1"));
parameterList.remove("NAME1");
assertNull(parameterList.get("name1"));
parameterList.remove("name3");
assertEquals("; name2=VALUE", parameterList.toString());
}
public void testNoValueParameterList() {
try {
MimeTypeParameterList parameterList = new MimeTypeParameterList("; name=");
fail("Expected MimeTypeParseException");
} catch (MimeTypeParseException e) {
// ok
}
}
public void testMissingValueParameterList() {
try {
MimeTypeParameterList parameterList = new MimeTypeParameterList("; name=;name2=value");
fail("Expected MimeTypeParseException");
} catch (MimeTypeParseException e) {
// ok
}
}
public void testNoNameParameterList() {
try {
MimeTypeParameterList parameterList = new MimeTypeParameterList("; = value");
// if running on Java 6, the activation framework is included directly in the JRE...it appears
// the reference implementation is not handling this correctly.
// fail("Expected MimeTypeParseException");
} catch (MimeTypeParseException e) {
// ok
}
}
public void testUnterminatedQuotedString() {
try {
MimeTypeParameterList parameterList = new MimeTypeParameterList("; = \"value");
fail("Expected MimeTypeParseException");
} catch (MimeTypeParseException e) {
// ok
}
}
public void testSpecialInAttribute() {
String specials = "()<>@,;:\\\"/[]?= \t";
for (int i=0; i < specials.length(); i++) {
try {
MimeTypeParameterList parameterList = new MimeTypeParameterList(";na"+specials.charAt(i)+"me=value");
fail("Expected MimeTypeParseException for special: " + specials.charAt(i));
} catch (MimeTypeParseException e) {
// ok
}
}
}
}
| 617 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/DataHandlerTest.java | /**
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.activation;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import junit.framework.TestCase;
/**
* @version $Rev$ $Date$
*/
public class DataHandlerTest extends TestCase {
private CommandMap defaultMap;
public void testObjectInputStream() throws IOException {
DataHandler handler = new DataHandler("Hello World", "text/plain");
InputStream is = handler.getInputStream();
byte[] bytes = new byte[128];
assertEquals(11, is.read(bytes));
assertEquals("Hello World", new String(bytes, 0, 11));
}
protected void setUp() throws Exception {
defaultMap = CommandMap.getDefaultCommandMap();
MailcapCommandMap myMap = new MailcapCommandMap();
myMap.addMailcap("text/plain;; x-java-content-handler=" + DummyTextHandler.class.getName());
CommandMap.setDefaultCommandMap(myMap);
}
protected void tearDown() throws Exception {
CommandMap.setDefaultCommandMap(defaultMap);
}
public static class DummyTextHandler implements DataContentHandler {
public DataFlavor[] getTransferDataFlavors() {
throw new UnsupportedOperationException();
}
public Object getTransferData(DataFlavor df, DataSource ds) throws UnsupportedFlavorException, IOException {
throw new UnsupportedOperationException();
}
public Object getContent(DataSource ds) throws IOException {
throw new UnsupportedOperationException();
}
public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
os.write(((String)obj).getBytes());
}
}
}
| 618 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/MailcapCommandMapTest.java | /**
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.activation;
import junit.framework.TestCase;
/**
* @version $Rev$ $Date$
*/
public class MailcapCommandMapTest extends TestCase {
private MailcapCommandMap map;
public void testAdd() {
map.addMailcap("foo/bar ;; x-java-view=Foo; x-java-edit=Bar");
CommandInfo info = map.getCommand("foo/bar", "view");
assertEquals("view", info.getCommandName());
assertEquals("Foo", info.getCommandClass());
info = map.getCommand("foo/bar", "edit");
assertEquals("edit", info.getCommandName());
assertEquals("Bar", info.getCommandClass());
}
public void testExplicitWildcard() {
map.addMailcap("foo/bar ;; x-java-view=Bar");
map.addMailcap("foo/* ;; x-java-view=Star");
CommandInfo info = map.getCommand("foo/bar", "view");
assertEquals("view", info.getCommandName());
assertEquals("Bar", info.getCommandClass());
info = map.getCommand("foo/foo", "view");
assertEquals("view", info.getCommandName());
assertEquals("Star", info.getCommandClass());
info = map.getCommand("foo/*", "view");
assertEquals("view", info.getCommandName());
assertEquals("Star", info.getCommandClass());
// The reference implementation does not appear to handle this the same way.
// info = map.getCommand("foo", "view");
// assertEquals("view", info.getCommandName());
// assertEquals("Star", info.getCommandClass());
}
public void testImplicitWildcard() {
map.addMailcap("foo/bar ;; x-java-view=Bar");
map.addMailcap("foo ;; x-java-view=Star");
CommandInfo info = map.getCommand("foo/bar", "view");
assertEquals("view", info.getCommandName());
assertEquals("Bar", info.getCommandClass());
info = map.getCommand("foo/foo", "view");
assertEquals("view", info.getCommandName());
assertEquals("Star", info.getCommandClass());
// The RI is not finding this one either
// info = map.getCommand("foo/*", "view");
// assertEquals("view", info.getCommandName());
// assertEquals("Star", info.getCommandClass());
}
public void testParameterizedMimeType() {
// TODO: the RI is not getting a hit on this one.
// map.addMailcap("foo/bar ;; x-java-view=Bar");
// CommandInfo info = map.getCommand("foo/bar ; type=\"text/plain\"", "view");
// assertEquals(
// assertEquals("view", info.getCommandName());
// assertEquals("Bar", info.getCommandClass());
}
public void testGetNativeCommands() {
MailcapCommandMap tmap = new MailcapCommandMap();
// a few filler entries just to increase the noise level.
tmap.addMailcap("image/gif;;x-java-view=com.sun.activation.viewers.ImageViewer");
tmap.addMailcap("image/jpeg;;x-java-view=com.sun.activation.viewers.ImageViewer");
tmap.addMailcap("text/*;yada yada;x-java-view=com.sun.activation.viewers.TextViewer");
// neither of these is a match
tmap.addMailcap("text/*;;x-java-edit=com.sun.activation.viewers.TextEditor");
tmap.addMailcap("text/*; ;x-java-edit=com.sun.activation.viewers.TextEditor");
// need one with multiple entries
tmap.addMailcap("text/plain;yada yada;x-java-view=com.sun.activation.viewers.TextViewer");
tmap.addMailcap("text/plain;bad a bing;x-java-view=com.sun.activation.viewers.TextViewer");
String[] commands = tmap.getNativeCommands("text/*");
assertEquals(1, commands.length);
assertEquals("text/*;yada yada;x-java-view=com.sun.activation.viewers.TextViewer", commands[0]);
commands = tmap.getNativeCommands("text/plain");
assertEquals(2, commands.length);
assertTrue("text/plain;yada yada;x-java-view=com.sun.activation.viewers.TextViewer".equals(commands[0]) ||
"text/plain;bad a bing;x-java-view=com.sun.activation.viewers.TextViewer".equals(commands[0]));
assertTrue("text/plain;yada yada;x-java-view=com.sun.activation.viewers.TextViewer".equals(commands[1]) ||
"text/plain;bad a bing;x-java-view=com.sun.activation.viewers.TextViewer".equals(commands[1]));
commands = tmap.getNativeCommands("image/gif");
assertEquals(0, commands.length);
commands = tmap.getNativeCommands("text/html");
assertEquals(0, commands.length);
}
protected void setUp() throws Exception {
super.setUp();
map = new MailcapCommandMap();
}
}
| 619 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/MimetypesFileTypeMapTest.java | /**
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.activation;
import java.util.Map;
import junit.framework.TestCase;
/**
* @version $Rev$ $Date$
*/
public class MimetypesFileTypeMapTest extends TestCase {
private MimetypesFileTypeMap typeMap;
public void testDefault() {
// unmapped
assertEquals("application/octet-stream", typeMap.getContentType("x.foo"));
// from META-INF/mimetypes.default
assertEquals("text/html", typeMap.getContentType("x.html"));
}
public void testCommentRemoval() {
typeMap.addMimeTypes(" text/foo foo #txt");
assertEquals("text/foo", typeMap.getContentType("x.foo"));
typeMap.addMimeTypes("#text/foo bar");
assertEquals("text/foo", typeMap.getContentType("x.foo"));
typeMap.addMimeTypes("text/foo #bar");
assertEquals("text/foo", typeMap.getContentType("x.foo"));
}
protected void setUp() throws Exception {
super.setUp();
typeMap = new MimetypesFileTypeMap();
}
}
| 620 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/test/java/javax/activation/ActivationDataFlavorTest.java | /**
*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.activation;
import java.io.InputStream;
import java.awt.datatransfer.DataFlavor;
import junit.framework.TestCase;
/**
* @version $Rev$ $Date$
*/
public class ActivationDataFlavorTest extends TestCase {
public void testMimeTypeConstructorWithoutClass() {
ActivationDataFlavor adf = new ActivationDataFlavor("application/*", null);
assertEquals("application/*", adf.getMimeType());
assertEquals(InputStream.class, adf.getRepresentationClass());
}
public void testMimeTypeConstructorWithClass() {
ActivationDataFlavor adf = new ActivationDataFlavor("application/x-java-serialized-object; class=java.lang.Object", null);
assertEquals("application/x-java-serialized-object; class=java.lang.Object", adf.getMimeType());
assertEquals(InputStream.class, adf.getRepresentationClass());
}
public void testHumanName() {
ActivationDataFlavor adf = new ActivationDataFlavor("text/html", "Human Name");
assertEquals("Human Name", adf.getHumanPresentableName());
adf.setHumanPresentableName("Name 2");
assertEquals("Name 2", adf.getHumanPresentableName());
adf = new ActivationDataFlavor("text/html", null);
assertNull(adf.getHumanPresentableName());
}
public void testEquals() {
ActivationDataFlavor adf1 = new ActivationDataFlavor("text/plain", "text/plain");
DataFlavor adf2 = new DataFlavor("text/plain", "text/plain");
assertTrue(adf1.equals(adf2));
}
}
| 621 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/org/apache/geronimo/specs | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/org/apache/geronimo/specs/activation/CommandMapBundleTrackerCustomizer.java | /**
* 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.geronimo.specs.activation;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import javax.activation.MailcapCommandMap;
import javax.activation.CommandMap;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.BundleTrackerCustomizer;
public class CommandMapBundleTrackerCustomizer implements BundleTrackerCustomizer {
// our base Activator (used as a service source)
private Activator activator;
// the bundle hosting the activation code
private Bundle activationBundle;
// the accumulated list of provider bundles that have command definitions
private ConcurrentMap<Long, URL> mailCaps = new ConcurrentHashMap<Long, URL>();
public CommandMapBundleTrackerCustomizer(Activator a, Bundle b) {
activator = a;
activationBundle = b;
}
/**
* Handle the activation of a new bundle.
*
* @param bundle The source bundle.
* @param event The bundle event information.
*
* @return A return object.
*/
public Object addingBundle(Bundle bundle, BundleEvent event) {
if (bundle.equals(activationBundle)) {
return null;
}
return registerBundle(bundle);
}
/**
* Perform the check for an existing mailcap file when
* a bundle is registered.
*
* @param bundle The potential provider bundle.
*
* @return A URL object if this bundle contains a mailcap file.
*/
private Object registerBundle(Bundle bundle) {
URL url = bundle.getResource("/META-INF/mailcap");
if (url != null) {
log(LogService.LOG_DEBUG, "found mailcap at " + url);
mailCaps.put(bundle.getBundleId(), url);
rebuildCommandMap();
}
// the url marks our interest in additional activity for this
// bundle.
return url;
}
/**
* Remove a bundle from our potential mailcap pool.
*
* @param bundle The potential source bundle.
*/
protected void unregisterBundle(Bundle bundle) {
URL mailcap = mailCaps.remove(bundle.getBundleId());
if (mailcap != null ){
log(LogService.LOG_DEBUG, "removing mailcap at " + mailcap);
rebuildCommandMap();
}
}
public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) {
log(LogService.LOG_DEBUG, "Bundle Considered for mailcap providers: " + bundle.getSymbolicName());
// this will update for the new bundle
registerBundle(bundle);
}
public void removedBundle(Bundle bundle, BundleEvent event, Object object) {
unregisterBundle(bundle);
}
private void log(int level, String message) {
activator.log(level, message);
}
private void log(int level, String message, Throwable th) {
activator.log(level, message, th);
}
/**
* Rebuild a new default command map after a change in
* the status of bundles providing command maps.
*/
private void rebuildCommandMap() {
MailcapCommandMap commandMap = new MailcapCommandMap();
for (URL url : mailCaps.values()) {
try {
InputStream is = url.openStream();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
commandMap.addMailcap(line);
}
} finally {
is.close();
}
} catch (Exception e) {
// Ignore
}
}
// this is our new default command map
CommandMap.setDefaultCommandMap(commandMap);
}
}
| 622 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/org/apache/geronimo/specs | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/org/apache/geronimo/specs/activation/Activator.java | /**
* 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.geronimo.specs.activation;
import java.util.ArrayList;
import java.util.List;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.BundleTracker;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
/**
* The activator that starts and manages the tracking of
* JAF activation command maps
*/
public class Activator extends org.apache.geronimo.osgi.locator.Activator {
// tracker to watch for bundle updates
protected BundleTracker bt;
// service tracker for a logging service
protected ServiceTracker lst;
// an array of all active logging services.
List<LogService> logServices = new ArrayList<LogService>();
@Override
public synchronized void start(final BundleContext context) throws Exception {
super.start(context);
lst = new LogServiceTracker(context, LogService.class.getName(), null);
lst.open();
bt = new BundleTracker(context, Bundle.ACTIVE, new CommandMapBundleTrackerCustomizer(this, context.getBundle()));
bt.open();
}
@Override
public synchronized void stop(BundleContext context) throws Exception {
bt.close();
lst.close();
super.stop(context);
}
void log(int level, String message) {
synchronized (logServices) {
for (LogService log : logServices) {
log.log(level, message);
}
}
}
void log(int level, String message, Throwable th) {
synchronized (logServices) {
for (LogService log : logServices) {
log.log(level, message, th);
}
}
}
private final class LogServiceTracker extends ServiceTracker {
private LogServiceTracker(BundleContext context, String clazz,
ServiceTrackerCustomizer customizer) {
super(context, clazz, customizer);
}
@Override
public Object addingService(ServiceReference reference) {
Object svc = super.addingService(reference);
if (svc instanceof LogService) {
synchronized (logServices) {
logServices.add((LogService) svc);
}
}
return svc;
}
@Override
public void removedService(ServiceReference reference, Object service) {
synchronized (logServices) {
logServices.remove(service);
}
super.removedService(reference, service);
}
}
}
| 623 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/MimetypesFileTypeMap.java | /*
* 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 javax.activation;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Map;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.Enumeration;
import java.net.URL;
/**
* @version $Rev$ $Date$
*/
public class MimetypesFileTypeMap extends FileTypeMap {
private static final String DEFAULT_TYPE = "application/octet-stream";
private final Map types = new HashMap();
public MimetypesFileTypeMap() {
// defaults from /META-INF/mimetypes.default
try {
InputStream is = MimetypesFileTypeMap.class.getResourceAsStream("/META-INF/mimetypes.default");
if (is != null) {
try {
loadStream(is);
} finally {
is.close();
}
}
} catch (IOException e) {
// ignore
}
// defaults from resources called /META-INF/mime.types
try {
ClassLoader cl = MimetypesFileTypeMap.class.getClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
Enumeration e = cl.getResources("/META-INF/mime.types");
while (e.hasMoreElements()) {
URL url = (URL) e.nextElement();
try {
InputStream is = url.openStream();
try {
loadStream(is);
} finally {
is.close();
}
} catch (IOException e1) {
continue;
}
}
} catch (SecurityException e) {
// ignore
} catch (IOException e) {
// ignore
}
// defaults from ${java.home}/lib/mime.types
try {
File file = new File(System.getProperty("java.home"), "lib/mime.types");
InputStream is = new FileInputStream(file);
try {
loadStream(is);
} finally {
is.close();
}
} catch (SecurityException e) {
// ignore
} catch (FileNotFoundException e) {
// ignore
} catch (IOException e) {
// ignore
}
// defaults from ${user.home}/.mime.types
try {
File file = new File(System.getProperty("user.home"), ".mime.types");
InputStream is = new FileInputStream(file);
try {
loadStream(is);
} finally {
is.close();
}
} catch (SecurityException e) {
// ignore
} catch (FileNotFoundException e) {
// ignore
} catch (IOException e) {
// ignore
}
}
public MimetypesFileTypeMap(String mimeTypeFileName) throws IOException {
this();
BufferedReader reader = new BufferedReader(new FileReader(mimeTypeFileName));
try {
String line;
while ((line = reader.readLine()) != null) {
addMimeTypes(line);
}
reader.close();
} catch (IOException e) {
try {
reader.close();
} catch (IOException e1) {
// ignore to allow original cause through
}
throw e;
}
}
public MimetypesFileTypeMap(InputStream is) {
this();
try {
loadStream(is);
} catch (IOException e) {
// ignore as the spec's signature says we can't throw IOException - doh!
}
}
private void loadStream(InputStream is) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = reader.readLine()) != null) {
addMimeTypes(line);
}
}
public synchronized void addMimeTypes(String mime_types) {
int hashPos = mime_types.indexOf('#');
if (hashPos != -1) {
mime_types = mime_types.substring(0, hashPos);
}
StringTokenizer tok = new StringTokenizer(mime_types);
if (!tok.hasMoreTokens()) {
return;
}
String contentType = tok.nextToken();
while (tok.hasMoreTokens()) {
String fileType = tok.nextToken();
types.put(fileType, contentType);
}
}
public String getContentType(File f) {
return getContentType(f.getName());
}
public synchronized String getContentType(String filename) {
int index = filename.lastIndexOf('.');
if (index == -1 || index == filename.length()-1) {
return DEFAULT_TYPE;
}
String fileType = filename.substring(index + 1);
String contentType = (String) types.get(fileType);
return contentType == null ? DEFAULT_TYPE : contentType;
}
}
| 624 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/URLDataSource.java | /*
* 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 javax.activation;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
/**
* @version $Rev$ $Date$
*/
public class URLDataSource implements DataSource {
private final static String DEFAULT_CONTENT_TYPE = "application/octet-stream";
private final URL url;
/**
* Creates a URLDataSource from a URL object.
*/
public URLDataSource(URL url) {
this.url = url;
}
/**
* Returns the value of the URL content-type header field.
* This method calls URL.openConnection() to obtain a connection
* from which to obtain the content type. If this fails or
* a getContentType() returns null then "application/octet-stream"
* is returned.
*/
public String getContentType() {
try {
URLConnection connection = url.openConnection();
String type = connection.getContentType();
return type == null ? DEFAULT_CONTENT_TYPE : type;
} catch (IOException e) {
return DEFAULT_CONTENT_TYPE;
}
}
/**
* Returns the file name of the URL object.
* @return the name as returned by URL.getFile()
*/
public String getName() {
return url.getFile();
}
/**
* Returns an InputStream obtained from the URL.
* @return the InputStream from URL.openStream()
*/
public InputStream getInputStream() throws IOException {
return url.openStream();
}
/**
* Returns an OutputStream obtained from the URL.
*/
public OutputStream getOutputStream() throws IOException {
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
return connection.getOutputStream();
}
/**
* Returns the URL of the data source.
*/
public URL getURL() {
return url;
}
} | 625 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/UnsupportedDataTypeException.java | /*
* 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 javax.activation;
import java.io.IOException;
/**
* @version $Rev$ $Date$
*/
public class UnsupportedDataTypeException extends IOException {
public UnsupportedDataTypeException() {
super();
}
public UnsupportedDataTypeException(String s) {
super(s);
}
}
| 626 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/MailcapCommandMap.java | /*
* 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 javax.activation;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.security.Security;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.geronimo.osgi.locator.ProviderLocator;
/**
* @version $Rev$ $Date$
*/
public class MailcapCommandMap extends CommandMap {
private final Map mimeTypes = new HashMap();
private final Map preferredCommands = new HashMap();
private final Map allCommands = new HashMap();
// the unparsed commands from the mailcap file.
private final Map nativeCommands = new HashMap();
// commands identified as fallbacks...these are used last, and also used as wildcards.
private final Map fallbackCommands = new HashMap();
private URL url;
public MailcapCommandMap() {
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
// process /META-INF/mailcap.default
try {
InputStream is = MailcapCommandMap.class.getResourceAsStream("/META-INF/mailcap.default");
if (is != null) {
try {
parseMailcap(is);
} finally {
is.close();
}
}
} catch (IOException e) {
// ignore
}
// process /META-INF/mailcap resources
try {
Enumeration e = contextLoader.getResources("META-INF/mailcap");
while (e.hasMoreElements()) {
url = ((URL) e.nextElement());
try {
InputStream is = url.openStream();
try {
parseMailcap(is);
} finally {
is.close();
}
} catch (IOException e1) {
continue;
}
}
} catch (SecurityException e) {
// ignore
} catch (IOException e) {
// ignore
}
// process ${java.home}/lib/mailcap
try {
File file = new File(System.getProperty("java.home"), "lib/mailcap");
InputStream is = new FileInputStream(file);
try {
parseMailcap(is);
} finally {
is.close();
}
} catch (SecurityException e) {
// ignore
} catch (IOException e) {
// ignore
}
// process ${user.home}/lib/mailcap
try {
File file = new File(System.getProperty("user.home"), ".mailcap");
InputStream is = new FileInputStream(file);
try {
parseMailcap(is);
} finally {
is.close();
}
} catch (SecurityException e) {
// ignore
} catch (IOException e) {
// ignore
}
}
public MailcapCommandMap(String fileName) throws IOException {
this();
FileReader reader = new FileReader(fileName);
try {
parseMailcap(reader);
} finally {
reader.close();
}
}
public MailcapCommandMap(InputStream is) {
this();
parseMailcap(is);
}
private void parseMailcap(InputStream is) {
try {
parseMailcap(new InputStreamReader(is));
} catch (IOException e) {
// spec API means all we can do is swallow this
}
}
void parseMailcap(Reader reader) throws IOException {
BufferedReader br = new BufferedReader(reader);
String line;
while ((line = br.readLine()) != null) {
addMailcap(line);
}
}
public synchronized void addMailcap(String mail_cap) {
int index = 0;
// skip leading whitespace
index = skipSpace(mail_cap, index);
if (index == mail_cap.length() || mail_cap.charAt(index) == '#') {
return;
}
// get primary type
int start = index;
index = getToken(mail_cap, index);
if (start == index) {
return;
}
String mimeType = mail_cap.substring(start, index);
// skip any spaces after the primary type
index = skipSpace(mail_cap, index);
if (index == mail_cap.length() || mail_cap.charAt(index) == '#') {
return;
}
// get sub-type
if (mail_cap.charAt(index) == '/') {
index = skipSpace(mail_cap, ++index);
start = index;
index = getToken(mail_cap, index);
mimeType = mimeType + '/' + mail_cap.substring(start, index);
} else {
mimeType = mimeType + "/*";
}
// we record all mappings using the lowercase version.
mimeType = mimeType.toLowerCase();
// skip spaces after mime type
index = skipSpace(mail_cap, index);
// expect a ';' to terminate field 1
if (index == mail_cap.length() || mail_cap.charAt(index) != ';') {
return;
}
// ok, we've parsed the mime text field, now parse the view field. If there's something
// there, then we add this to the native text.
index = skipSpace(mail_cap, index + 1);
// if the next encountered text is not a ";", then we have a view. This gets added to the
// native list.
if (index == mail_cap.length() || mail_cap.charAt(index) != ';') {
ArrayList nativeCommandList = (ArrayList)nativeCommands.get(mimeType);
// if this is the first for this mimetype, create a holder
if (nativeCommandList == null) {
nativeCommandList = new ArrayList();
nativeCommands.put(mimeType, nativeCommandList);
}
// now add this as an entry in the list.
nativeCommandList.add(mail_cap);
// now skip forward to the next field marker, if any
index = getMText(mail_cap, index);
}
// we don't know which list this will be added to until we finish parsing, as there
// can be an x-java-fallback-entry parameter that moves this to the fallback list.
List commandList = new ArrayList();
// but by default, this is not a fallback.
boolean fallback = false;
int fieldNumber = 0;
// parse fields
while (index < mail_cap.length() && mail_cap.charAt(index) == ';') {
index = skipSpace(mail_cap, index + 1);
start = index;
index = getToken(mail_cap, index);
String fieldName = mail_cap.substring(start, index).toLowerCase();
index = skipSpace(mail_cap, index);
if (index < mail_cap.length() && mail_cap.charAt(index) == '=') {
index = skipSpace(mail_cap, index + 1);
start = index;
index = getMText(mail_cap, index);
String value = mail_cap.substring(start, index);
index = skipSpace(mail_cap, index);
if (fieldName.startsWith("x-java-") && fieldName.length() > 7) {
String command = fieldName.substring(7);
value = value.trim();
if (command.equals("fallback-entry")) {
if (value.equals("true")) {
fallback = true;
}
}
else {
// create a CommandInfo item and add it the accumulator
CommandInfo info = new CommandInfo(command, value);
commandList.add(info);
}
}
}
}
addCommands(mimeType, commandList, fallback);
}
/**
* Add a parsed list of commands to the appropriate command list.
*
* @param mimeType The mimeType name this is added under.
* @param commands A List containing the command information.
* @param fallback The target list identifier.
*/
private void addCommands(String mimeType, List commands, boolean fallback) {
// add this to the mimeType set
mimeTypes.put(mimeType, mimeType);
// the target list changes based on the type of entry.
Map target = fallback ? fallbackCommands : preferredCommands;
// now process
for (Iterator i = commands.iterator(); i.hasNext();) {
CommandInfo info = (CommandInfo)i.next();
addCommand(target, mimeType, info);
// if this is not a fallback position, then this to the allcommands list.
if (!fallback) {
List cmdList = (List) allCommands.get(mimeType);
if (cmdList == null) {
cmdList = new ArrayList();
allCommands.put(mimeType, cmdList);
}
cmdList.add(info);
}
}
}
/**
* Add a command to a target command list (preferred or fallback).
*
* @param commandList
* The target command list.
* @param mimeType The MIME type the command is associated with.
* @param command The command information.
*/
private void addCommand(Map commandList, String mimeType, CommandInfo command) {
Map commands = (Map) commandList.get(mimeType);
if (commands == null) {
commands = new HashMap();
commandList.put(mimeType, commands);
}
commands.put(command.getCommandName(), command);
}
private int skipSpace(String s, int index) {
while (index < s.length() && Character.isWhitespace(s.charAt(index))) {
index++;
}
return index;
}
private int getToken(String s, int index) {
while (index < s.length() && s.charAt(index) != '#' && !MimeType.isSpecial(s.charAt(index))) {
index++;
}
return index;
}
private int getMText(String s, int index) {
while (index < s.length()) {
char c = s.charAt(index);
if (c == '#' || c == ';' || Character.isISOControl(c)) {
return index;
}
if (c == '\\') {
index++;
if (index == s.length()) {
return index;
}
}
index++;
}
return index;
}
public synchronized CommandInfo[] getPreferredCommands(String mimeType) {
// get the mimetype as a lowercase version.
mimeType = mimeType.toLowerCase();
Map commands = (Map) preferredCommands.get(mimeType);
if (commands == null) {
commands = (Map) preferredCommands.get(getWildcardMimeType(mimeType));
}
Map fallbackCommands = getFallbackCommands(mimeType);
// if we have fall backs, then we need to merge this stuff.
if (fallbackCommands != null) {
// if there's no command list, we can just use this as the master list.
if (commands == null) {
commands = fallbackCommands;
}
else {
// merge the two lists. The ones in the commands list will take precedence.
commands = mergeCommandMaps(commands, fallbackCommands);
}
}
// now convert this into an array result.
if (commands == null) {
return new CommandInfo[0];
}
return (CommandInfo[]) commands.values().toArray(new CommandInfo[commands.size()]);
}
private Map getFallbackCommands(String mimeType) {
Map commands = (Map) fallbackCommands.get(mimeType);
// now we also need to search this as if it was a wildcard. If we get a wildcard hit,
// we have to merge the two lists.
Map wildcardCommands = (Map)fallbackCommands.get(getWildcardMimeType(mimeType));
// no wildcard version
if (wildcardCommands == null) {
return commands;
}
// we need to merge these.
return mergeCommandMaps(commands, wildcardCommands);
}
private Map mergeCommandMaps(Map main, Map fallback) {
// create a cloned copy of the second map. We're going to use a PutAll operation to
// overwrite any duplicates.
Map result = new HashMap(fallback);
result.putAll(main);
return result;
}
public synchronized CommandInfo[] getAllCommands(String mimeType) {
mimeType = mimeType.toLowerCase();
List exactCommands = (List) allCommands.get(mimeType);
if (exactCommands == null) {
exactCommands = Collections.EMPTY_LIST;
}
List wildCommands = (List) allCommands.get(getWildcardMimeType(mimeType));
if (wildCommands == null) {
wildCommands = Collections.EMPTY_LIST;
}
Map fallbackCommands = getFallbackCommands(mimeType);
if (fallbackCommands == null) {
fallbackCommands = Collections.EMPTY_MAP;
}
CommandInfo[] result = new CommandInfo[exactCommands.size() + wildCommands.size() + fallbackCommands.size()];
int j = 0;
for (int i = 0; i < exactCommands.size(); i++) {
result[j++] = (CommandInfo) exactCommands.get(i);
}
for (int i = 0; i < wildCommands.size(); i++) {
result[j++] = (CommandInfo) wildCommands.get(i);
}
for (Iterator i = fallbackCommands.keySet().iterator(); i.hasNext();) {
result[j++] = (CommandInfo) fallbackCommands.get((String)i.next());
}
return result;
}
public synchronized CommandInfo getCommand(String mimeType, String cmdName) {
mimeType = mimeType.toLowerCase();
// strip any parameters from the supplied mimeType
int i = mimeType.indexOf(';');
if (i != -1) {
mimeType = mimeType.substring(0, i).trim();
}
// search for an exact match
Map commands = (Map) preferredCommands.get(mimeType);
if (commands == null) {
// then a wild card match
commands = (Map) preferredCommands.get(getWildcardMimeType(mimeType));
if (commands == null) {
// then fallback searches, both standard and wild card.
commands = (Map) fallbackCommands.get(mimeType);
if (commands == null) {
commands = (Map) fallbackCommands.get(getWildcardMimeType(mimeType));
}
if (commands == null) {
return null;
}
}
}
return (CommandInfo) commands.get(cmdName.toLowerCase());
}
private String getWildcardMimeType(String mimeType) {
int i = mimeType.indexOf('/');
if (i == -1) {
return mimeType + "/*";
} else {
return mimeType.substring(0, i + 1) + "*";
}
}
public synchronized DataContentHandler createDataContentHandler(String mimeType) {
CommandInfo info = getCommand(mimeType, "content-handler");
if (info == null) {
return null;
}
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = getClass().getClassLoader();
}
try {
return (DataContentHandler) ProviderLocator.loadClass(info.getCommandClass(), this.getClass(), cl).newInstance();
} catch (ClassNotFoundException e) {
return null;
} catch (IllegalAccessException e) {
return null;
} catch (InstantiationException e) {
return null;
}
}
/**
* Get all MIME types known to this command map.
*
* @return A String array of the MIME type names.
*/
public synchronized String[] getMimeTypes() {
ArrayList types = new ArrayList(mimeTypes.values());
return (String[])types.toArray(new String[types.size()]);
}
/**
* Return the list of raw command strings parsed
* from the mailcap files for a given mimeType.
*
* @param mimeType The target mime type
*
* @return A String array of the raw command strings. Returns
* an empty array if the mimetype is not currently known.
*/
public synchronized String[] getNativeCommands(String mimeType) {
ArrayList commands = (ArrayList)nativeCommands.get(mimeType.toLowerCase());
if (commands == null) {
return new String[0];
}
return (String[])commands.toArray(new String[commands.size()]);
}
}
| 627 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/DataContentHandler.java | /*
* 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 javax.activation;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.io.OutputStream;
/**
* @version $Rev$ $Date$
*/
public interface DataContentHandler {
public DataFlavor[] getTransferDataFlavors();
public Object getTransferData(DataFlavor df, DataSource ds) throws UnsupportedFlavorException, IOException;
public Object getContent(DataSource ds) throws IOException;
public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException;
} | 628 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/ActivationDataFlavor.java | /*
* 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 javax.activation;
import java.awt.datatransfer.DataFlavor;
import java.io.InputStream;
/**
* @version $Rev$ $Date$
*/
public class ActivationDataFlavor extends DataFlavor {
private final Class representationClass;
private final String mimeType;
private String humanPresentableName;
public ActivationDataFlavor(Class representationClass, String mimeType, String humanPresentableName) {
this.representationClass = representationClass;
this.mimeType = mimeType;
this.humanPresentableName = humanPresentableName;
}
public ActivationDataFlavor(Class representationClass, String humanPresentableName) {
this.representationClass = representationClass;
this.mimeType = "application/x-java-serialized-object";
this.humanPresentableName = humanPresentableName;
}
public ActivationDataFlavor(String mimeType, String humanPresentableName) {
this.mimeType = mimeType;
this.representationClass = InputStream.class;
this.humanPresentableName = humanPresentableName;
}
public String getMimeType() {
return mimeType;
}
public Class getRepresentationClass() {
return representationClass;
}
public String getHumanPresentableName() {
return humanPresentableName;
}
public void setHumanPresentableName(String humanPresentableName) {
this.humanPresentableName = humanPresentableName;
}
public boolean equals(DataFlavor dataFlavor) {
return this.isMimeTypeEqual(dataFlavor.getMimeType()) && representationClass == dataFlavor.getRepresentationClass();
}
public boolean isMimeTypeEqual(String mimeType) {
try {
MimeType thisType = new MimeType(this.mimeType);
MimeType thatType = new MimeType(mimeType);
return thisType.match(thatType);
} catch (MimeTypeParseException e) {
return false;
}
}
protected String normalizeMimeTypeParameter(String parameterName, String parameterValue) {
return parameterName + "=" + parameterValue;
}
protected String normalizeMimeType(String mimeType) {
return mimeType;
}
} | 629 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/CommandObject.java | /*
* 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 javax.activation;
import java.io.IOException;
/**
* @version $Rev$ $Date$
*/
public interface CommandObject {
public void setCommandContext(String verb, DataHandler dh) throws IOException;
} | 630 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/DataHandler.java | /*
* 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 javax.activation;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.URL;
/**
* @version $Rev$ $Date$
*/
public class DataHandler implements Transferable {
private final DataSource ds;
private final DataFlavor flavor;
private CommandMap commandMap;
private DataContentHandler dch;
public DataHandler(DataSource ds) {
this.ds = ds;
this.flavor = new ActivationDataFlavor(ds.getContentType(), null);
}
public DataHandler(Object data, String type) {
this.ds = new ObjectDataSource(data, type);
this.flavor = new ActivationDataFlavor(data.getClass(), null);
}
public DataHandler(URL url) {
this.ds = new URLDataSource(url);
this.flavor = new ActivationDataFlavor(ds.getContentType(), null);
}
public DataSource getDataSource() {
return ds;
}
public String getName() {
return ds.getName();
}
public String getContentType() {
return ds.getContentType();
}
public InputStream getInputStream() throws IOException {
return ds.getInputStream();
}
public void writeTo(OutputStream os) throws IOException {
if (ds instanceof ObjectDataSource) {
ObjectDataSource ods = (ObjectDataSource) ds;
DataContentHandler dch = getDataContentHandler();
if (dch == null) {
throw new UnsupportedDataTypeException(ods.mimeType);
}
dch.writeTo(ods.data, ods.mimeType, os);
} else {
byte[] buffer = new byte[1024];
InputStream is = getInputStream();
try {
int count;
while ((count = is.read(buffer)) != -1) {
os.write(buffer, 0, count);
}
} finally {
is.close();
}
}
}
public OutputStream getOutputStream() throws IOException {
return ds.getOutputStream();
}
public synchronized DataFlavor[] getTransferDataFlavors() {
return getDataContentHandler().getTransferDataFlavors();
}
public boolean isDataFlavorSupported(DataFlavor flavor) {
DataFlavor[] flavors = getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
DataFlavor dataFlavor = flavors[i];
if (dataFlavor.equals(flavor)) {
return true;
}
}
return false;
}
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
DataContentHandler dch = getDataContentHandler();
if (dch != null) {
return dch.getTransferData(flavor, ds);
} else if (this.flavor.match(flavor)) {
if (ds instanceof ObjectDataSource) {
return ((ObjectDataSource) ds).data;
} else {
return ds.getInputStream();
}
} else {
throw new UnsupportedFlavorException(flavor);
}
}
public CommandInfo[] getPreferredCommands() {
return getCommandMap().getPreferredCommands(ds.getContentType());
}
public CommandInfo[] getAllCommands() {
return getCommandMap().getAllCommands(ds.getContentType());
}
public CommandInfo getCommand(String cmdName) {
return getCommandMap().getCommand(ds.getContentType(), cmdName);
}
public Object getContent() throws IOException {
if (ds instanceof ObjectDataSource) {
return ((ObjectDataSource) ds).data;
} else {
DataContentHandler dch = getDataContentHandler();
if (dch != null) {
return dch.getContent(ds);
} else {
return ds.getInputStream();
}
}
}
public Object getBean(CommandInfo cmdinfo) {
try {
return cmdinfo.getCommandObject(this, this.getClass().getClassLoader());
} catch (IOException e) {
return null;
} catch (ClassNotFoundException e) {
return null;
}
}
/**
* A local implementation of DataSouce used to wrap an Object and mime-type.
*/
private class ObjectDataSource implements DataSource {
private final Object data;
private final String mimeType;
public ObjectDataSource(Object data, String mimeType) {
this.data = data;
this.mimeType = mimeType;
}
public String getName() {
return null;
}
public String getContentType() {
return mimeType;
}
public InputStream getInputStream() throws IOException {
final DataContentHandler dch = getDataContentHandler();
if (dch == null) {
throw new UnsupportedDataTypeException(mimeType);
}
final PipedInputStream is = new PipedInputStream();
final PipedOutputStream os = new PipedOutputStream(is);
Thread thread = new Thread("DataHandler Pipe Pump") {
public void run() {
try {
try {
dch.writeTo(data, mimeType, os);
} finally {
os.close();
}
} catch (IOException e) {
// ignore, per spec - doh!
}
}
};
thread.start();
return is;
}
public OutputStream getOutputStream() throws IOException {
return null;
}
}
public synchronized void setCommandMap(CommandMap commandMap) {
this.commandMap = commandMap;
this.dch = null;
}
private synchronized CommandMap getCommandMap() {
return commandMap != null ? commandMap : CommandMap.getDefaultCommandMap();
}
/**
* Search for a DataContentHandler for our mime type.
* The search is performed by first checking if a global factory has been set using
* {@link #setDataContentHandlerFactory(DataContentHandlerFactory)};
* if found then it is called to attempt to create a handler.
* If this attempt fails, we then call the command map set using {@link #setCommandMap(CommandMap)}
* (or if that has not been set, the default map returned by {@link CommandMap#getDefaultCommandMap()})
* to create the handler.
*
* The resulting handler is cached until the global factory is changed.
*
* @return
*/
private synchronized DataContentHandler getDataContentHandler() {
DataContentHandlerFactory localFactory;
synchronized (DataHandler.class) {
if (factory != originalFactory) {
// setDCHF was called - clear our cached copy of the DCH and DCHF
dch = null;
originalFactory = factory;
}
localFactory = originalFactory;
}
if (dch == null) {
// get the main mime-type portion of the content.
String mimeType = getMimeType(ds.getContentType());
if (localFactory != null) {
dch = localFactory.createDataContentHandler(mimeType);
}
if (dch == null) {
if (commandMap != null) {
dch = commandMap.createDataContentHandler(mimeType);
} else {
dch = CommandMap.getDefaultCommandMap().createDataContentHandler(mimeType);
}
}
}
return dch;
}
/**
* Retrieve the base MIME type from a content type. This parses
* the type into its base components, stripping off any parameter
* information.
*
* @param contentType
* The content type string.
*
* @return The MIME type identifier portion of the content type.
*/
private String getMimeType(String contentType) {
try {
MimeType mimeType = new MimeType(contentType);
return mimeType.getBaseType();
} catch (MimeTypeParseException e) {
}
return contentType;
}
/**
* This is used to check if the DataContentHandlerFactory has been changed.
* This is not specified behaviour but this check is required to make this work like the RI.
*/
private DataContentHandlerFactory originalFactory;
{
synchronized (DataHandler.class) {
originalFactory = factory;
}
}
private static DataContentHandlerFactory factory;
/**
* Set the DataContentHandlerFactory to use.
* If this method has already been called then an Error is raised.
*
* @param newFactory the new factory
* @throws SecurityException if the caller does not have "SetFactory" RuntimePermission
*/
public static synchronized void setDataContentHandlerFactory(DataContentHandlerFactory newFactory) {
if (factory != null) {
throw new Error("javax.activation.DataHandler.setDataContentHandlerFactory has already been defined");
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkSetFactory();
}
factory = newFactory;
}
}
| 631 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/MimeTypeParameterList.java | /*
* 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 javax.activation;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* @version $Rev$ $Date$
*/
public class MimeTypeParameterList {
private final Map params = new HashMap();
public MimeTypeParameterList() {
}
public MimeTypeParameterList(String parameterList) throws MimeTypeParseException {
parse(parameterList);
}
protected void parse(String parameterList) throws MimeTypeParseException {
if (parameterList == null) {
throw new MimeTypeParseException("parameterList is null");
}
RFC2045Parser parser = new RFC2045Parser(parameterList);
while (parser.hasMoreParams()) {
String attribute = parser.expectAttribute();
parser.expectEquals();
String value = parser.expectValue();
params.put(attribute.toLowerCase(), value);
}
}
public int size() {
return params.size();
}
public boolean isEmpty() {
return params.isEmpty();
}
public String get(String name) {
return (String) params.get(name.toLowerCase());
}
public void set(String name, String value) {
params.put(name.toLowerCase(), value);
}
public void remove(String name) {
params.remove(name.toLowerCase());
}
public Enumeration getNames() {
return Collections.enumeration(params.keySet());
}
/**
* String representation of this parameter list.
*
* @return
*/
public String toString() {
StringBuffer buf = new StringBuffer(params.size() << 4);
for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
buf.append("; ").append(entry.getKey()).append('=');
quote(buf, (String) entry.getValue());
}
return buf.toString();
}
private void quote(StringBuffer buf, String value) {
int length = value.length();
boolean quote = false;
for (int i = 0; i < length; i++) {
if (MimeType.isSpecial(value.charAt(i))) {
quote = true;
break;
}
}
if (quote) {
buf.append('"');
for (int i = 0; i < length; i++) {
char c = value.charAt(i);
if (c == '\\' || c == '"') {
buf.append('\\');
}
buf.append(c);
}
buf.append('"');
} else {
buf.append(value);
}
}
private static class RFC2045Parser {
private final String text;
private int index = 0;
private RFC2045Parser(String text) {
this.text = text;
}
/**
* Look the next ";" to start a parameter (skipping whitespace)
*
* @return
*/
private boolean hasMoreParams() throws MimeTypeParseException {
char c;
do {
if (index == text.length()) {
return false;
}
c = text.charAt(index++);
} while (Character.isWhitespace(c));
if (c != ';') {
throw new MimeTypeParseException("Expected \";\" at " + (index - 1) + " in " + text);
}
return true;
}
private String expectAttribute() throws MimeTypeParseException {
char c;
do {
if (index == text.length()) {
throw new MimeTypeParseException("Expected attribute at " + (index - 1) + " in " + text);
}
c = text.charAt(index++);
} while (Character.isWhitespace(c));
int start = index - 1;
while (index != text.length() && !MimeType.isSpecial(text.charAt(index))) {
index += 1;
}
return text.substring(start, index);
}
private void expectEquals() throws MimeTypeParseException {
char c;
do {
if (index == text.length()) {
throw new MimeTypeParseException("Expected \"=\" at " + (index - 1) + " in " + text);
}
c = text.charAt(index++);
} while (Character.isWhitespace(c));
if (c != '=') {
throw new MimeTypeParseException("Expected \"=\" at " + (index - 1) + " in " + text);
}
}
private String expectValue() throws MimeTypeParseException {
char c;
do {
if (index == text.length()) {
throw new MimeTypeParseException("Expected value at " + (index - 1) + " in " + text);
}
c = text.charAt(index++);
} while (Character.isWhitespace(c));
if (c == '"') {
// quoted-string
StringBuffer buf = new StringBuffer();
while (true) {
if (index == text.length()) {
throw new MimeTypeParseException("Expected closing quote at " + (index - 1) + " in " + text);
}
c = text.charAt(index++);
if (c == '"') {
break;
}
if (c == '\\') {
if (index == text.length()) {
throw new MimeTypeParseException("Expected escaped char at " + (index - 1) + " in " + text);
}
c = text.charAt(index++);
}
buf.append(c);
}
return buf.toString();
} else {
// token
int start = index - 1;
while (index != text.length() && !MimeType.isSpecial(text.charAt(index))) {
index += 1;
}
return text.substring(start, index);
}
}
}
} | 632 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/DataContentHandlerFactory.java | /*
* 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 javax.activation;
/**
* @version $Rev$ $Date$
*/
public interface DataContentHandlerFactory {
public DataContentHandler createDataContentHandler(String mimeType);
}
| 633 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/MimeTypeParseException.java | /*
* 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 javax.activation;
/**
* @version $Rev$ $Date$
*/
public class MimeTypeParseException extends Exception {
public MimeTypeParseException() {
super();
}
public MimeTypeParseException(String s) {
super(s);
}
}
| 634 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/FileDataSource.java | /*
* 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 javax.activation;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @version $Rev$ $Date$
*/
public class FileDataSource implements DataSource {
private final File file;
private FileTypeMap fileTypeMap;
/**
* Creates a FileDataSource from a File object
*/
public FileDataSource(File file) {
this.file = file;
}
/**
* Creates a FileDataSource from the specified path name
*/
public FileDataSource(String name) {
this(new File(name));
}
/**
* Return the InputStream obtained from the data source
*/
public InputStream getInputStream() throws IOException {
return new FileInputStream(file);
}
/**
* Return the OutputStream obtained from the data source
*/
public OutputStream getOutputStream() throws IOException {
return new FileOutputStream(file);
}
/**
* Returns the content type of the data source
*/
public String getContentType() {
if (fileTypeMap == null) {
return FileTypeMap.getDefaultFileTypeMap().getContentType(file);
} else {
return fileTypeMap.getContentType(file);
}
}
/**
* Returns the name of the data source object
*/
public String getName() {
return file.getName();
}
/**
* Returns the data source file
*/
public File getFile() {
return file;
}
/**
* Sets the FileTypeMap associated with the data source
*/
public void setFileTypeMap(FileTypeMap map) {
fileTypeMap = map;
}
} | 635 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/CommandInfo.java | /*
* 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 javax.activation;
import java.beans.Beans;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInputStream;
/**
* @version $Rev$ $Date$
*/
public class CommandInfo {
private final String commandName;
private final String commandClass;
/**
* Constructor for a CommandInfo
*
* @param commandName the command name
* @param commandClass the name of the command's implementation class
*/
public CommandInfo(String commandName, String commandClass) {
this.commandName = commandName;
this.commandClass = commandClass;
}
/**
* Return the command name.
*
* @return the command name
*/
public String getCommandName() {
return commandName;
}
/**
* Return the implementation class name.
*
* @return the name of the command's implementation class; may be null
*/
public String getCommandClass() {
return commandClass;
}
/**
* Instantiate and return a command JavaBean.
* The bean is created using Beans.instantiate(loader, commandClass).
* If the new bean implements CommandObject then its setCommandContext(String, DataHandler)
* method is called.
* Otherwise if it implements Externalizable and the supplied DataHandler is not null
* then its readExternal(ObjectInputStream) method is called with a stream obtained from
* DataHandler.getInputStream().
*
* @param dh a DataHandler that provides the data to be passed to the command
* @param loader the ClassLoader to be used to instantiate the command
* @return a new command instance
* @throws IOException if there was a problem initializing the command
* @throws ClassNotFoundException if the command class could not be found
*/
public Object getCommandObject(DataHandler dh, ClassLoader loader) throws IOException, ClassNotFoundException {
Object bean = Beans.instantiate(loader, commandClass);
if (bean instanceof CommandObject) {
((CommandObject) bean).setCommandContext(commandName, dh);
} else if (bean instanceof Externalizable && dh != null) {
((Externalizable) bean).readExternal(new ObjectInputStream(dh.getInputStream()));
}
return bean;
}
} | 636 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/MimeType.java | /*
* 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 javax.activation;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/**
* @version $Rev$ $Date$
*/
public class MimeType implements Externalizable {
private static final String SPECIALS = "()<>@,;:\\\"/[]?=";
static boolean isSpecial(char c) {
return Character.isWhitespace(c) || Character.isISOControl(c) || SPECIALS.indexOf(c) != -1;
}
private String primaryType = "application";
private String subType = "*";
private final MimeTypeParameterList parameterList = new MimeTypeParameterList();;
public MimeType() {
}
public MimeType(String rawdata) throws MimeTypeParseException {
parseMimeType(rawdata);
}
public MimeType(String primary, String sub) throws MimeTypeParseException {
setPrimaryType(primary);
setSubType(sub);
}
public String getPrimaryType() {
return primaryType;
}
public void setPrimaryType(String primary) throws MimeTypeParseException {
primaryType = parseToken(primary);
}
public String getSubType() {
return subType;
}
public void setSubType(String sub) throws MimeTypeParseException {
subType = parseToken(sub);
}
public MimeTypeParameterList getParameters() {
return parameterList;
}
public String getParameter(String name) {
return parameterList.get(name);
}
public void setParameter(String name, String value) {
parameterList.set(name, value);
}
public void removeParameter(String name) {
parameterList.remove(name);
}
public String toString() {
return getBaseType() + parameterList.toString();
}
public String getBaseType() {
return getPrimaryType() + '/' + getSubType();
}
public boolean match(MimeType type) {
if (!primaryType.equals(type.primaryType)) return false;
if ("*".equals(subType)) return true;
if ("*".equals(type.subType)) return true;
return subType.equals(type.subType);
}
public boolean match(String rawdata) throws MimeTypeParseException {
return match(new MimeType(rawdata));
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(toString());
out.flush();
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
try {
parseMimeType(in.readUTF());
} catch (MimeTypeParseException mtpex) {
throw new IOException(mtpex.getMessage());
}
}
private void parseMimeType(String rawData) throws MimeTypeParseException {
int index = rawData.indexOf('/');
if (index == -1) {
throw new MimeTypeParseException("Expected '/'");
}
setPrimaryType(rawData.substring(0, index));
int index2 = rawData.indexOf(';', index+1);
if (index2 == -1) {
setSubType(rawData.substring(index+1));
} else {
setSubType(rawData.substring(index+1, index2));
parameterList.parse(rawData.substring(index2));
}
}
private static String parseToken(String tokenString) throws MimeTypeParseException {
tokenString = tokenString.trim();
for (int i=0; i < tokenString.length(); i++) {
char c = tokenString.charAt(i);
if (isSpecial(c)) {
throw new MimeTypeParseException("Special '" + c + "' not allowed in token");
}
}
return tokenString;
}
}
| 637 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/CommandMap.java | /*
* 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 javax.activation;
/**
* @version $Rev$ $Date$
*/
public abstract class CommandMap {
private static CommandMap defaultCommandMap = new MailcapCommandMap();
/**
* Return the default CommandMap. If this has not been explictly set
* using setDefaultCommandMap() then a MailcapCommandMap is returned.
* @return the default CommandMap
*/
public static CommandMap getDefaultCommandMap() {
return defaultCommandMap;
}
/**
* Set the default CommandMap.
*
* @param commandMap the new default CommandMap; if null resets to a MailcapCommandMap
* @throws SecurityException if the caller does not have "SetFactory" RuntimePermission
*/
public static void setDefaultCommandMap(CommandMap commandMap) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkSetFactory();
}
defaultCommandMap = commandMap == null ? new MailcapCommandMap() : commandMap;
}
public CommandMap() {
}
/**
* Get the preferred commands for the given
* mimetype, as modified by the DataSource. The
* default implementation is just a delegation to
* getPreferredCommands(mimeType), but the concrete
* implementations can define additional behavior.
*
* @param mimeType The mimeType name.
* @param ds The datasource providing the type object.
*
* @return The array of CommandInfo[] objects associated with
* this mimeType/DataSource combo.
*/
public CommandInfo[] getPreferredCommands(String mimeType, DataSource ds) {
return getPreferredCommands(mimeType);
}
/**
* Get the preferred commands for the given
* mimetype. The concrete implementations define the
* actual behaviour.
*
* @param mimeType The mimeType name.
*
* @return The array of CommandInfo[] objects associated with
* this mimeType combo.
*/
public abstract CommandInfo[] getPreferredCommands(String mimeType);
/**
* Get the entire command set for the given
* mimetype, as modified by the DataSource. The
* default implementation is just a delegation to
* getAllCommands(mimeType), but the concrete
* implementations can define additional behavior.
*
* @param mimeType The mimeType name.
* @param ds The datasource providing the type object.
*
* @return The array of CommandInfo[] objects associated with
* this mimeType/DataSource combo.
*/
public CommandInfo[] getAllCommands(String mimeType, DataSource ds) {
return getAllCommands(mimeType);
}
/**
* Get all available commands for the given
* mimetype. The concrete implementations define the
* actual behaviour.
*
* @param mimeType The mimeType name.
*
* @return The array of CommandInfo[] objects associated with
* this mimeType combo.
*/
public abstract CommandInfo[] getAllCommands(String mimeType);
/**
* Get the default command implementation for a
* given mimeType/DataSource combo.
*
* The default implementation just delegates to
* getCommand(mimeType, cmdName). Subclasses may
* provide more specialized behavior.
*
* @param mimeType The name of the mime type
* @param cmdName The command action we wish to perform.
* @param ds The modifying DataSource.
*
* @return A CommandInfo object corresponding to the command
* mapping.
*/
public CommandInfo getCommand(String mimeType, String cmdName, DataSource ds) {
return getCommand(mimeType, cmdName);
}
/**
* Get the default command implementation for a
* give mimeType
*
* @param mimeType The name of the mime type
* @param cmdName The command action we wish to perform.
*
* @return A CommandInfo object corresponding to the command
* mapping.
*/
public abstract CommandInfo getCommand(String mimeType, String cmdName);
/**
* Locate a DataContentHandler for the given mime
* type. The concrete implementations determine
* how this mapping is performed.
*
* @param mimeType The target MIME type.
* @param ds The DataSource associated with this request.
*
* @return The DataContentHandler for the MIME type.
*/
public DataContentHandler createDataContentHandler(String mimeType, DataSource ds) {
return createDataContentHandler(mimeType);
}
/**
* Locate a DataContentHandler for the given mime
* type. The concrete implementations determine
* how this mapping is performed.
*
* @param mimeType The target MIME type.
*
* @return The DataContentHandler for the MIME type.
*/
public abstract DataContentHandler createDataContentHandler(String mimeType);
/**
* Return all mime types known to this CommandMap, or null if none.
*
* @return a String array of all mime types known to this CommandMap
*/
public String[] getMimeTypes() {
return null;
}
} | 638 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/FileTypeMap.java | /*
* 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 javax.activation;
import java.io.File;
/**
* FileTypeMap is an abstract class that provides a data type interface for files.
*
* @version $Rev$ $Date$
*/
public abstract class FileTypeMap {
// we use null here rather than a default because
// the constructor for MimetypesFileTypeMap does a lot of I/O
private static FileTypeMap defaultFileTypeMap = null;
/**
* Sets the default FileTypeMap for the system.
* @param fileMap the new default FileTypeMap
* @throws SecurityException if the caller does not have "SetFactory" RuntimePermission
*/
public static void setDefaultFileTypeMap(FileTypeMap fileMap) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkSetFactory();
}
defaultFileTypeMap = fileMap;
}
/**
* Returns the default FileTypeMap
* @return the default FileTYpeMap; if null returns a MimetypesFileTypeMap
*/
public synchronized static FileTypeMap getDefaultFileTypeMap() {
if (defaultFileTypeMap == null) {
defaultFileTypeMap = new MimetypesFileTypeMap();
}
return defaultFileTypeMap;
}
public FileTypeMap() {
}
public abstract String getContentType(File file);
public abstract String getContentType(String filename);
} | 639 |
0 | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-activation_1.1_spec/src/main/java/javax/activation/DataSource.java | /*
* 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 javax.activation;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @version $Rev$ $Date$
*/
public interface DataSource {
public abstract InputStream getInputStream() throws IOException;
public abstract OutputStream getOutputStream() throws IOException;
public abstract String getContentType();
public abstract String getName();
}
| 640 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/PostConstruct.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PostConstruct {
}
| 641 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/Resource.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Resource {
public enum AuthenticationType {
CONTAINER,
APPLICATION
}
String name() default "";
Class type() default Object.class;
AuthenticationType authenticationType()
default AuthenticationType.CONTAINER;
boolean shareable() default true;
String mappedName() default "";
String description() default "";
}
| 642 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/Resources.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Resources {
Resource[] value();
}
| 643 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/PreDestroy.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PreDestroy {
}
| 644 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/Generated.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @version $Rev$ $Date$
*/
@Target({
ElementType.PACKAGE,
ElementType.TYPE,
ElementType.ANNOTATION_TYPE,
ElementType.METHOD,
ElementType.CONSTRUCTOR,
ElementType.FIELD,
ElementType.LOCAL_VARIABLE,
ElementType.PARAMETER
})
@Retention(RetentionPolicy.SOURCE)
@Documented
public @interface Generated {
String[] value();
String date() default "";
String comments() default "";
}
| 645 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/security/TransportProtected.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation.security;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
/**
* @version $Rev$ $Date$
*/
@Retention (RUNTIME)
@Target({TYPE, METHOD})
public @interface TransportProtected {
boolean value() default true;
}
| 646 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/security/RunAs.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation.security;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface RunAs {
String value();
}
| 647 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/security/DeclareRoles.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation.security;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface DeclareRoles {
String[] value();
}
| 648 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/security/DenyAll.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation.security;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DenyAll {
}
| 649 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/security/PermitAll.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation.security;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PermitAll {
}
| 650 |
0 | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation | Create_ds/geronimo-specs/geronimo-annotation_1.0-MR1_spec/src/main/java/javax/annotation/security/RolesAllowed.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.annotation.security;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Documented;
/**
* @version $Rev$ $Date$
*/
@Documented
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface RolesAllowed {
String[] value();
}
| 651 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/POST.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@HttpMethod(value = "POST")
public @interface POST {
}
| 652 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/Encoded.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD,
ElementType.CONSTRUCTOR, ElementType.TYPE})
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface Encoded {
}
| 653 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/PathParam.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface PathParam {
String value();
}
| 654 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/FormParam.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface FormParam {
String value();
}
| 655 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/HeaderParam.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface HeaderParam {
String value();
}
| 656 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/HttpMethod.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.ANNOTATION_TYPE)
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface HttpMethod {
public static final String DELETE = "DELETE";
public static final String GET = "GET";
public static final String HEAD = "HEAD";
public static final String POST = "POST";
public static final String PUT = "PUT";
public static final String OPTIONS = "OPTIONS";
String value();
}
| 657 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/MatrixParam.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface MatrixParam {
String value();
}
| 658 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/Produces.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Inherited
@Target(value = {ElementType.TYPE, ElementType.METHOD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Produces {
String[] value() default "*/*";
}
| 659 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/QueryParam.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface QueryParam {
String value();
}
| 660 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/Consumes.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Inherited
@Target(value = {ElementType.TYPE, ElementType.METHOD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Consumes {
String[] value() default "*/*";
}
| 661 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/CookieParam.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface CookieParam {
String value();
}
| 662 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/DefaultValue.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface DefaultValue {
String value();
}
| 663 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/HEAD.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@HttpMethod(value = "HEAD")
public @interface HEAD {
}
| 664 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/OPTIONS.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@HttpMethod(value = "OPTIONS")
public @interface OPTIONS {
}
| 665 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/PUT.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@HttpMethod(value = "PUT")
public @interface PUT {
}
| 666 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ApplicationPath.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.TYPE)
@Retention(value = RetentionPolicy.RUNTIME)
public @interface ApplicationPath {
public String value();
}
| 667 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/WebApplicationException.java | /*
* 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 javax.ws.rs;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
public class WebApplicationException extends RuntimeException {
private static final long serialVersionUID = 11660101L;
private final Response response;
public WebApplicationException() {
this(Status.INTERNAL_SERVER_ERROR);
}
public WebApplicationException(int status) {
response = Response.status(status).build();
}
public WebApplicationException(Response.Status status) {
response = Response.status(status).build();
}
public WebApplicationException(Response response) {
this.response = response;
}
public WebApplicationException(Throwable cause) {
this(cause, Status.INTERNAL_SERVER_ERROR);
}
public WebApplicationException(Throwable cause, int status) {
super(cause);
response = Response.status(status).build();
}
public WebApplicationException(Throwable cause, Response.Status status) {
super(cause);
response = Response.status(status).build();
}
public WebApplicationException(Throwable cause, Response response) {
super(cause);
this.response = response;
}
public Response getResponse() {
return response;
}
}
| 668 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/DELETE.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@HttpMethod(value = "DELETE")
public @interface DELETE {
}
| 669 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/GET.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
@HttpMethod(value = "GET")
public @interface GET {
}
| 670 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/Path.java | /*
* 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 javax.ws.rs;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.TYPE, ElementType.METHOD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Path {
String value();
}
| 671 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/Variant.java | /*
* 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 javax.ws.rs.core;
import java.util.Locale;
import javax.ws.rs.ext.RuntimeDelegate;
public class Variant {
public abstract static class VariantListBuilder {
protected VariantListBuilder() {
/* do nothing */
}
public abstract Variant.VariantListBuilder add();
public abstract java.util.List<Variant> build();
public abstract Variant.VariantListBuilder encodings(String... values);
public abstract Variant.VariantListBuilder languages(Locale... values);
public abstract Variant.VariantListBuilder mediaTypes(MediaType... values);
private final static RuntimeDelegate delegate = RuntimeDelegate.getInstance();
public static Variant.VariantListBuilder newInstance() {
return delegate.createVariantListBuilder();
}
}
public static Variant.VariantListBuilder encodings(String... values) {
return VariantListBuilder.newInstance().encodings(values);
}
public static Variant.VariantListBuilder languages(java.util.Locale... values) {
return VariantListBuilder.newInstance().languages(values);
}
public static Variant.VariantListBuilder mediaTypes(MediaType... values) {
return VariantListBuilder.newInstance().mediaTypes(values);
}
private final MediaType mediaType;
private final Locale language;
private final String encoding;
public Variant(MediaType mediaType, Locale language, String encoding) {
if (mediaType == null && language == null && encoding == null) {
throw new IllegalArgumentException();
}
this.mediaType = mediaType;
this.language = language;
this.encoding = encoding;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Variant)) {
return false;
}
Variant other = (Variant)obj;
String encoding = getEncoding();
if (encoding == null) {
if (other.getEncoding() != null) {
return false;
}
} else {
if (!encoding.equals(other.getEncoding())) {
return false;
}
}
Locale locale = getLanguage();
if (locale == null) {
if (other.getLanguage() != null) {
return false;
}
} else {
if (!locale.equals(other.getLanguage())) {
return false;
}
}
MediaType mt = getMediaType();
if (mt == null) {
if (other.getMediaType() != null) {
return false;
}
} else {
return mt.equals(other.getMediaType());
}
return true;
}
public String getEncoding() {
return encoding;
}
public java.util.Locale getLanguage() {
return language;
}
public MediaType getMediaType() {
return mediaType;
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + ((language == null) ? 0 : language.hashCode());
result = 31 * result + ((encoding == null) ? 0 : encoding.hashCode());
result = 31 * result + ((mediaType == null) ? 0 : mediaType.hashCode());
return result;
}
}
| 672 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/Application.java | /*
* 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 javax.ws.rs.core;
import java.util.Collections;
import java.util.Set;
public class Application {
public Set<java.lang.Class<?>> getClasses() {
return Collections.emptySet();
}
public Set<Object> getSingletons() {
return Collections.emptySet();
}
}
| 673 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/GenericEntity.java | /*
* 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 javax.ws.rs.core;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
public class GenericEntity<T> {
private final T entity;
private final Type genericType;
protected GenericEntity(T entity) {
if (entity == null) {
throw new IllegalArgumentException();
}
this.entity = entity;
Type superclass = this.getClass().getGenericSuperclass();
this.genericType = ((ParameterizedType)superclass).getActualTypeArguments()[0];
// TODO: what if the user extends their GenericEntity superclass?
}
public GenericEntity(T entity, Type genericType) {
if (entity == null) {
throw new IllegalArgumentException();
}
if (genericType == null) {
throw new IllegalArgumentException();
}
checkCompatibility(entity.getClass(), genericType);
this.entity = entity;
this.genericType = genericType;
}
private void checkCompatibility(Class<?> rawType, Type genericType) {
if (genericType instanceof Class<?>) {
if (!((Class<?>)genericType).isAssignableFrom(rawType)) {
throw new IllegalArgumentException();
}
} else if (genericType instanceof ParameterizedType) {
checkCompatibility(rawType, ((ParameterizedType)genericType).getRawType());
} else if (genericType instanceof GenericArrayType) {
if (!rawType.isArray()) {
throw new IllegalArgumentException();
}
// check the array parameter
checkCompatibility(rawType.getComponentType(), ((GenericArrayType)genericType)
.getGenericComponentType());
}
}
public final T getEntity() {
return entity;
}
public final Class<?> getRawType() {
return entity.getClass();
}
public final Type getType() {
return genericType;
}
}
| 674 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/Response.java | /*
* 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 javax.ws.rs.core;
import java.net.URI;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import javax.ws.rs.ext.RuntimeDelegate;
public abstract class Response {
private final static RuntimeDelegate delegate = RuntimeDelegate.getInstance();
public abstract static class ResponseBuilder {
protected ResponseBuilder() {
// do nothing
}
public abstract Response build();
public abstract Response.ResponseBuilder cacheControl(CacheControl value);
@Override
public abstract Response.ResponseBuilder clone();
public abstract Response.ResponseBuilder contentLocation(URI value);
public abstract Response.ResponseBuilder cookie(NewCookie... values);
public abstract Response.ResponseBuilder entity(Object value);
public abstract Response.ResponseBuilder expires(Date value);
public abstract Response.ResponseBuilder header(String name, Object value);
public abstract Response.ResponseBuilder language(Locale value);
public abstract Response.ResponseBuilder language(String value);
public abstract Response.ResponseBuilder lastModified(Date value);
public abstract Response.ResponseBuilder location(URI value);
protected static Response.ResponseBuilder newInstance() {
return delegate.createResponseBuilder();
}
public abstract Response.ResponseBuilder status(int value);
public Response.ResponseBuilder status(Response.Status value) {
return delegate.createResponseBuilder().status(value.getStatusCode());
}
public Response.ResponseBuilder status(Response.StatusType status) {
return delegate.createResponseBuilder().status(status.getStatusCode());
}
public abstract Response.ResponseBuilder tag(EntityTag value);
public abstract Response.ResponseBuilder tag(String value);
public abstract Response.ResponseBuilder type(MediaType value);
public abstract Response.ResponseBuilder type(String type);
public abstract Response.ResponseBuilder variant(Variant value);
public abstract Response.ResponseBuilder variants(List<Variant> values);
}
public static enum Status implements StatusType {
OK(Family.SUCCESSFUL, 200, "OK"),
CREATED(Family.SUCCESSFUL, 201, "Created"),
ACCEPTED(Family.SUCCESSFUL, 202, "Accepted"),
NO_CONTENT(Family.SUCCESSFUL, 204, "No Content"),
MOVED_PERMANENTLY(Family.REDIRECTION, 301, "Moved Permanently"),
SEE_OTHER(Family.REDIRECTION, 303, "See Other"),
NOT_MODIFIED(Family.REDIRECTION, 304, "Not Modified"),
TEMPORARY_REDIRECT(Family.REDIRECTION, 307, "Temporary Redirect"),
BAD_REQUEST(Family.CLIENT_ERROR, 400,"Bad Request"),
UNAUTHORIZED(Family.CLIENT_ERROR, 401, "Unauthorized"),
FORBIDDEN(Family.CLIENT_ERROR, 403, "Forbidden"),
NOT_FOUND(Family.CLIENT_ERROR, 404, "Not Found"),
NOT_ACCEPTABLE(Family.CLIENT_ERROR, 406, "Not Acceptable"),
CONFLICT(Family.CLIENT_ERROR, 409, "Conflict"),
GONE(Family.CLIENT_ERROR, 410, "Gone"),
PRECONDITION_FAILED(Family.CLIENT_ERROR, 412, "Precondition Failed"),
UNSUPPORTED_MEDIA_TYPE(Family.CLIENT_ERROR, 415, "Unsupported Media Type"),
INTERNAL_SERVER_ERROR(Family.SERVER_ERROR, 500, "Internal Server Error"),
SERVICE_UNAVAILABLE(Family.SERVER_ERROR, 503, "Service Unavailable"), ;
private final Family family;
private final int statusCode;
private final String reasonPhrase;
private Status(Family family, int statusCode, String reasonPhrase) {
this.family = family;
this.statusCode = statusCode;
this.reasonPhrase = reasonPhrase;
}
public static enum Family {
INFORMATIONAL,
SUCCESSFUL,
REDIRECTION,
CLIENT_ERROR,
SERVER_ERROR,
OTHER
}
public static Status fromStatusCode(int statusCode) {
for (Status s : values()) {
if (s.getStatusCode() == statusCode) {
return s;
}
}
return null;
}
public int getStatusCode() {
return statusCode;
}
public Response.Status.Family getFamily() {
return family;
}
@Override
public String toString() {
return reasonPhrase;
}
public String getReasonPhrase() {
return reasonPhrase;
}
}
public interface StatusType {
public Response.Status.Family getFamily();
public String getReasonPhrase();
public int getStatusCode();
}
protected Response() {
// do nothing
}
public static Response.ResponseBuilder created(java.net.URI location) {
if (location == null) {
throw new IllegalArgumentException();
}
return status(Status.CREATED).location(location);
}
public static Response.ResponseBuilder fromResponse(Response response) {
ResponseBuilder builder = delegate.createResponseBuilder();
builder.status(response.getStatus());
builder.entity(response.getEntity());
MultivaluedMap<String, Object> metadata = response.getMetadata();
for (String key : metadata.keySet()) {
List<Object> values = metadata.get(key);
for (Object value : values) {
builder.header(key, value);
}
}
return builder;
}
public abstract Object getEntity();
public abstract MultivaluedMap<String, Object> getMetadata();
public abstract int getStatus();
public static Response.ResponseBuilder noContent() {
return status(Status.NO_CONTENT);
}
public static Response.ResponseBuilder notAcceptable(List<Variant> values) {
ResponseBuilder builder = status(Status.NOT_ACCEPTABLE);
if (values == null) {
return builder.variants(Collections.EMPTY_LIST);
}
return builder.variants(values);
}
public static Response.ResponseBuilder notModified() {
return status(Status.NOT_MODIFIED);
}
public static Response.ResponseBuilder notModified(EntityTag value) {
if (value == null) {
throw new IllegalArgumentException();
}
return status(Status.NOT_MODIFIED).tag(value);
}
public static Response.ResponseBuilder notModified(String value) {
if (value == null) {
throw new IllegalArgumentException();
}
return status(Status.NOT_MODIFIED).tag(value);
}
public static Response.ResponseBuilder ok() {
return status(Status.OK);
}
public static Response.ResponseBuilder ok(Object entity) {
return status(Status.OK).entity(entity);
}
public static Response.ResponseBuilder ok(Object entity, MediaType mediaType) {
return status(Status.OK).entity(entity).type(mediaType);
}
public static Response.ResponseBuilder ok(Object entity, String mediaType) {
return status(Status.OK).entity(entity).type(mediaType);
}
public static Response.ResponseBuilder ok(Object entity, Variant variant) {
return status(Status.OK).entity(entity).variant(variant);
}
public static Response.ResponseBuilder seeOther(URI location) {
if (location == null) {
throw new IllegalArgumentException();
}
return status(Status.SEE_OTHER).location(location);
}
public static Response.ResponseBuilder serverError() {
return status(Status.INTERNAL_SERVER_ERROR);
}
public static Response.ResponseBuilder status(int status) {
if (status < 100 || status > 599) {
throw new IllegalArgumentException();
}
return ResponseBuilder.newInstance().status(status);
}
public static Response.ResponseBuilder status(Response.Status status) {
if (status == null) {
throw new IllegalArgumentException();
}
return ResponseBuilder.newInstance().status(status);
}
public static Response.ResponseBuilder status(Response.StatusType status) {
if (status == null) {
throw new IllegalArgumentException();
}
return ResponseBuilder.newInstance().status(status);
}
public static Response.ResponseBuilder temporaryRedirect(URI location) {
return status(Status.TEMPORARY_REDIRECT).location(location);
}
}
| 675 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/NewCookie.java | /*
* 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 javax.ws.rs.core;
import javax.ws.rs.ext.RuntimeDelegate;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
public class NewCookie extends Cookie {
public static final int DEFAULT_MAX_AGE = -1;
private final String comment;
private final int maxAge;
private final boolean isSecure;
public NewCookie(String name, String value) {
this(name, value, null, null, null, DEFAULT_MAX_AGE, false);
}
public NewCookie(String name,
String value,
String path,
String domain,
String comment,
int maxAge,
boolean isSecure) {
this(name, value, path, domain, DEFAULT_VERSION, comment, maxAge, isSecure);
}
public NewCookie(String name,
String value,
String path,
String domain,
int version,
String comment,
int maxAge,
boolean isSecure) {
super(name, value, path, domain, version);
this.comment = comment;
this.maxAge = maxAge;
this.isSecure = isSecure;
}
public NewCookie(Cookie cookie) {
this(cookie, null, DEFAULT_MAX_AGE, false);
}
public NewCookie(Cookie cookie, String comment, int maxAge, boolean isSecure) {
super(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie
.getVersion());
this.comment = comment;
this.maxAge = maxAge;
this.isSecure = isSecure;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
// note that this must be a NewCookie exactly
if (getClass() != obj.getClass()) {
return false;
}
NewCookie other = (NewCookie)obj;
if (!getName().equals(other.getName())) {
return false;
}
if (getVersion() != other.getVersion()) {
return false;
}
if (isSecure != other.isSecure) {
return false;
}
if (maxAge != other.maxAge) {
return false;
}
String value = getValue();
if (value == null) {
if (other.getValue() != null) {
return false;
}
} else {
if (!value.equals(other.getValue())) {
return false;
}
}
String path = getPath();
if (path == null) {
if (other.getPath() != null) {
return false;
}
} else {
if (!path.equals(other.getPath())) {
return false;
}
}
String domain = getDomain();
if (domain == null) {
if (other.getDomain() != null) {
return false;
}
} else {
if (!domain.equals(other.getDomain())) {
return false;
}
}
if (comment == null) {
if (other.comment != null) {
return false;
}
} else {
if (!comment.equals(other.comment)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ((comment == null) ? 0 : comment.hashCode());
result = 31 * result + maxAge;
result = 31 * result + ((isSecure) ? 1 : 0);
return result;
}
public String getComment() {
return comment;
}
public int getMaxAge() {
return maxAge;
}
public boolean isSecure() {
return isSecure;
}
public Cookie toCookie() {
return new Cookie(getName(), getValue(), getPath(), getDomain(), getVersion());
}
private static final HeaderDelegate<NewCookie> headerDelegate =
RuntimeDelegate
.getInstance()
.createHeaderDelegate(NewCookie.class);
@Override
public String toString() {
return headerDelegate.toString(this);
}
public static NewCookie valueOf(String value) {
return headerDelegate.fromString(value);
}
}
| 676 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/Context.java | /*
* 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 javax.ws.rs.core;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = {ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface Context {
}
| 677 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/EntityTag.java | /*
* 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 javax.ws.rs.core;
import javax.ws.rs.ext.RuntimeDelegate;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
public class EntityTag {
private final boolean isWeak;
private final String value;
public EntityTag(String value) {
this(value, false);
}
public EntityTag(String value, boolean weak) {
if (value == null) {
throw new IllegalArgumentException();
}
this.value = value;
this.isWeak = weak;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof EntityTag)) {
return false;
}
EntityTag other = (EntityTag)obj;
if (isWeak != other.isWeak()) {
return false;
}
if (!value.equals(other.getValue())) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + ((isWeak) ? 1 : 0);
result = 31 * result + ((value == null) ? 0 : value.hashCode());
return result;
}
public String getValue() {
return value;
}
public boolean isWeak() {
return isWeak;
}
private static final HeaderDelegate<EntityTag> headerDelegate =
RuntimeDelegate
.getInstance()
.createHeaderDelegate(EntityTag.class);
@Override
public String toString() {
return headerDelegate.toString(this);
}
public static EntityTag valueOf(String value) {
return headerDelegate.fromString(value);
}
}
| 678 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/StreamingOutput.java | /*
* 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 javax.ws.rs.core;
import java.io.IOException;
import java.io.OutputStream;
public interface StreamingOutput {
public void write(OutputStream os) throws IOException;
}
| 679 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/PathSegment.java | /*
* 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 javax.ws.rs.core;
public interface PathSegment {
public MultivaluedMap<String, String> getMatrixParameters();
public String getPath();
}
| 680 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/HttpHeaders.java | /*
* 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 javax.ws.rs.core;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public interface HttpHeaders {
public static final String ACCEPT = "Accept";
public static final String ACCEPT_CHARSET = "Accept-Charset";
public static final String ACCEPT_ENCODING = "Accept-Encoding";
public static final String ACCEPT_LANGUAGE = "Accept-Language";
public static final String AUTHORIZATION = "Authorization";
public static final String CACHE_CONTROL = "Cache-Control";
public static final String CONTENT_ENCODING = "Content-Encoding";
public static final String CONTENT_LANGUAGE = "Content-Language";
public static final String CONTENT_LENGTH = "Content-Length";
public static final String CONTENT_LOCATION = "Content-Location";
public static final String CONTENT_TYPE = "Content-Type";
public static final String COOKIE = "Cookie";
public static final String DATE = "Date";
public static final String ETAG = "ETag";
public static final String EXPIRES = "Expires";
public static final String HOST = "Host";
public static final String IF_MATCH = "If-Match";
public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
public static final String IF_NONE_MATCH = "If-None-Match";
public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
public static final String LAST_MODIFIED = "Last-Modified";
public static final String LOCATION = "Location";
public static final String SET_COOKIE = "Set-Cookie";
public static final String USER_AGENT = "User-Agent";
public static final String VARY = "Vary";
public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
public List<Locale> getAcceptableLanguages();
public List<MediaType> getAcceptableMediaTypes();
public Map<String, Cookie> getCookies();
public Locale getLanguage();
public MediaType getMediaType();
public List<String> getRequestHeader(String name);
public MultivaluedMap<String, String> getRequestHeaders();
}
| 681 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/MediaType.java | /*
* 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 javax.ws.rs.core;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import javax.ws.rs.ext.RuntimeDelegate;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
public class MediaType {
public static final String APPLICATION_ATOM_XML =
"application/atom+xml";
public static final MediaType APPLICATION_ATOM_XML_TYPE =
new MediaType(
"application",
"atom+xml");
public static final String APPLICATION_FORM_URLENCODED =
"application/x-www-form-urlencoded";
public static final MediaType APPLICATION_FORM_URLENCODED_TYPE =
new MediaType(
"application",
"x-www-form-urlencoded");
public static final String APPLICATION_JSON =
"application/json";
public static final MediaType APPLICATION_JSON_TYPE =
new MediaType(
"application",
"json");
public static final String APPLICATION_OCTET_STREAM =
"application/octet-stream";
public static final MediaType APPLICATION_OCTET_STREAM_TYPE =
new MediaType(
"application",
"octet-stream");
public static final String APPLICATION_SVG_XML =
"application/svg+xml";
public static final MediaType APPLICATION_SVG_XML_TYPE =
new MediaType(
"application",
"svg+xml");
public static final String APPLICATION_XHTML_XML =
"application/xhtml+xml";
public static final MediaType APPLICATION_XHTML_XML_TYPE =
new MediaType(
"application",
"xhtml+xml");
public static final String APPLICATION_XML =
"application/xml";
public static final MediaType APPLICATION_XML_TYPE =
new MediaType(
"application",
"xml");
public static final String MEDIA_TYPE_WILDCARD = "*";
public static final String MULTIPART_FORM_DATA =
"multipart/form-data";
public static final MediaType MULTIPART_FORM_DATA_TYPE =
new MediaType(
"multipart",
"form-data");
public static final String TEXT_HTML = "text/html";
public static final MediaType TEXT_HTML_TYPE =
new MediaType(
"text",
"html");
public static final String TEXT_PLAIN = "text/plain";
public static final MediaType TEXT_PLAIN_TYPE =
new MediaType(
"text",
"plain");
public static final String TEXT_XML = "text/xml";
public static final MediaType TEXT_XML_TYPE =
new MediaType(
"text",
"xml");
public static final String WILDCARD = "*/*";
public static final MediaType WILDCARD_TYPE =
new MediaType(
"*",
"*");
private final String type;
private final String subtype;
private final Map<String, String> params;
private static final HeaderDelegate<MediaType> delegate =
RuntimeDelegate
.getInstance()
.createHeaderDelegate(MediaType.class);
public MediaType(String type, String subtype, Map<String, String> parameters) {
if (type == null) {
this.type = MEDIA_TYPE_WILDCARD;
} else {
this.type = type;
}
if (subtype == null) {
this.subtype = MEDIA_TYPE_WILDCARD;
} else {
this.subtype = subtype;
}
if (parameters == null) {
this.params = Collections.emptyMap();
} else {
// need to use a temporary map here since for some reason the ordering is important.
Map<String, String> temp = new TreeMap<String, String>(new Comparator<String>() {
public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2);
}
});
// need to put in as all lower case keys for comparisons, hashcode, and output
for (String key : parameters.keySet()) {
temp.put(key.toLowerCase(), parameters.get(key));
}
this.params = Collections.unmodifiableMap(temp);
}
}
public MediaType(String type, String subtype) {
this(type, subtype, null);
}
public MediaType() {
this(MEDIA_TYPE_WILDCARD, MEDIA_TYPE_WILDCARD);
}
public static MediaType valueOf(String type) throws java.lang.IllegalArgumentException {
return delegate.fromString(type);
}
public String getType() {
return type;
}
public boolean isWildcardType() {
return MEDIA_TYPE_WILDCARD.equals(getType());
}
public String getSubtype() {
return subtype;
}
public boolean isWildcardSubtype() {
return MEDIA_TYPE_WILDCARD.equals(getSubtype());
}
public Map<String, String> getParameters() {
return params;
}
public boolean isCompatible(MediaType other) {
if (other == null) {
return false;
}
if (isWildcardType() || other.isWildcardType()) {
return true;
}
if (isWildcardSubtype() || other.isWildcardSubtype()) {
return getType().equalsIgnoreCase(other.getType());
}
return getType().equalsIgnoreCase(other.getType()) && getSubtype().equalsIgnoreCase(other
.getSubtype());
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof MediaType)) {
return false;
}
MediaType other = (MediaType)obj;
return getType().equalsIgnoreCase(other.getType()) && getSubtype().equalsIgnoreCase(other
.getSubtype())
&& getParameters().equals(other.getParameters());
}
@Override
public int hashCode() {
int result = 17;
// be sure to lowercase for comparisions
// be careful about hash code. since not guaranteed that this is a final
// class, need to use methods. methods do not guarantee lowercase
result = 31 * result + getType().toLowerCase().hashCode();
result = 31 * result + getSubtype().toLowerCase().hashCode();
result = 31 * result + getParameters().hashCode();
return result;
}
@Override
public String toString() {
return delegate.toString(this);
}
}
| 682 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/SecurityContext.java | /*
* 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 javax.ws.rs.core;
import java.security.Principal;
public interface SecurityContext {
public static final java.lang.String BASIC_AUTH = "BASIC";
public static final java.lang.String CLIENT_CERT_AUTH = "CLIENT_CERT";
public static final java.lang.String DIGEST_AUTH = "DIGEST";
public static final java.lang.String FORM_AUTH = "FORM";
public String getAuthenticationScheme();
public Principal getUserPrincipal();
public boolean isSecure();
public boolean isUserInRole(String role);
}
| 683 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/UriInfo.java | /*
* 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 javax.ws.rs.core;
import java.net.URI;
import java.util.List;
public interface UriInfo {
public URI getAbsolutePath();
public UriBuilder getAbsolutePathBuilder();
public URI getBaseUri();
public UriBuilder getBaseUriBuilder();
public List<Object> getMatchedResources();
public List<String> getMatchedURIs();
public List<String> getMatchedURIs(boolean decode);
public String getPath();
public String getPath(boolean decode);
public MultivaluedMap<String, String> getPathParameters();
public MultivaluedMap<String, String> getPathParameters(boolean decode);
public List<PathSegment> getPathSegments();
public List<PathSegment> getPathSegments(boolean decode);
public MultivaluedMap<String, String> getQueryParameters();
public MultivaluedMap<String, String> getQueryParameters(boolean decode);
public URI getRequestUri();
public UriBuilder getRequestUriBuilder();
}
| 684 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/CacheControl.java | /*
* 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 javax.ws.rs.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.ext.RuntimeDelegate;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
public class CacheControl {
private int maxAge = -1;
private int sMaxAge = -1;
private boolean isPrivate = false;
private boolean noCache = false;
private boolean noStore = false;
private boolean noTransform = true;
private boolean mustRevalidate = false;
private boolean proxyRevalidate = false;
private Map<String, String> cacheExtensions = null;
private List<String> noCacheFields = null;
private List<String> privateFields = null;
public CacheControl() {
/* do nothing */
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
/*
* TODO: should the check be for instanceof or for getClass()? this
* class is not final so checking instanceof for now.
*/
if (!(obj instanceof CacheControl)) {
return false;
}
CacheControl other = (CacheControl)obj;
if (isPrivate != other.isPrivate()) {
return false;
}
if (noCache != other.isNoCache()) {
return false;
}
if (noStore != other.isNoStore()) {
return false;
}
if (noTransform != other.isNoTransform()) {
return false;
}
if (mustRevalidate != other.isMustRevalidate()) {
return false;
}
if (proxyRevalidate != other.isProxyRevalidate()) {
return false;
}
if (maxAge != other.getMaxAge()) {
return false;
}
if (sMaxAge != other.getSMaxAge()) {
return false;
}
if (!getCacheExtension().equals(other.getCacheExtension())) {
return false;
}
if (!getPrivateFields().equals(other.getPrivateFields())) {
return false;
}
if (!getNoCacheFields().equals(other.getNoCacheFields())) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + maxAge;
result = 31 * result + sMaxAge;
result = 31 * result + ((isPrivate) ? 1 : 0);
result = 31 * result + ((noCache) ? 1 : 0);
result = 31 * result + ((noStore) ? 1 : 0);
result = 31 * result + ((noTransform) ? 1 : 0);
result = 31 * result + ((mustRevalidate) ? 1 : 0);
result = 31 * result + ((proxyRevalidate) ? 1 : 0);
result = 31 * result + getCacheExtension().hashCode();
result = 31 * result + getNoCacheFields().hashCode();
result = 31 * result + getPrivateFields().hashCode();
return result;
}
public Map<String, String> getCacheExtension() {
if (cacheExtensions == null) {
cacheExtensions = new HashMap<String, String>();
}
return cacheExtensions;
}
public int getMaxAge() {
return maxAge;
}
public List<String> getNoCacheFields() {
if (noCacheFields == null) {
noCacheFields = new ArrayList<String>();
}
return noCacheFields;
}
public List<String> getPrivateFields() {
if (privateFields == null) {
privateFields = new ArrayList<String>();
}
return privateFields;
}
public int getSMaxAge() {
return sMaxAge;
}
public boolean isMustRevalidate() {
return mustRevalidate;
}
public boolean isNoCache() {
return noCache;
}
public boolean isNoStore() {
return noStore;
}
public boolean isNoTransform() {
return noTransform;
}
public boolean isPrivate() {
return isPrivate;
}
public boolean isProxyRevalidate() {
return proxyRevalidate;
}
public void setMaxAge(int maxAge) {
this.maxAge = maxAge;
}
public void setMustRevalidate(boolean mustRevalidate) {
this.mustRevalidate = mustRevalidate;
}
public void setNoCache(boolean noCache) {
this.noCache = noCache;
}
public void setNoStore(boolean noStore) {
this.noStore = noStore;
}
public void setNoTransform(boolean noTransform) {
this.noTransform = noTransform;
}
public void setPrivate(boolean isPrivate) {
this.isPrivate = isPrivate;
}
public void setProxyRevalidate(boolean proxyRevalidate) {
this.proxyRevalidate = proxyRevalidate;
}
public void setSMaxAge(int sMaxAge) {
this.sMaxAge = sMaxAge;
}
private final static HeaderDelegate<CacheControl> headerDelegate =
RuntimeDelegate
.getInstance()
.createHeaderDelegate(CacheControl.class);
@Override
public String toString() {
return headerDelegate.toString(this);
}
public static CacheControl valueOf(String value) {
return headerDelegate.fromString(value);
}
}
| 685 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/MultivaluedMap.java | /*
* 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 javax.ws.rs.core;
import java.util.List;
import java.util.Map;
public interface MultivaluedMap<K, V> extends Map<K, List<V>> {
public void add(K key, V value);
public V getFirst(K key);
public void putSingle(K key, V value);
}
| 686 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/Cookie.java | /*
* 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 javax.ws.rs.core;
import javax.ws.rs.ext.RuntimeDelegate;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
public class Cookie {
public static final int DEFAULT_VERSION = 1;
private final String name;
private final String value;
private final String path;
private final String domain;
private final int version;
public Cookie(String name, String value) {
this(name, value, null, null);
}
public Cookie(String name, String value, String path, String domain) {
this(name, value, path, domain, DEFAULT_VERSION);
}
public Cookie(String name, String value, String path, String domain, int version) {
if (name == null) {
throw new IllegalArgumentException();
}
this.name = name;
this.value = value;
this.path = path;
this.domain = domain;
this.version = version;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
// note that this must be a Cookie exactly
if (getClass() != obj.getClass()) {
return false;
}
Cookie other = (Cookie)obj;
if (!name.equals(other.name)) {
return false;
}
if (version != other.version) {
return false;
}
if (value == null) {
if (other.value != null) {
return false;
}
} else {
if (!value.equals(other.value)) {
return false;
}
}
if (path == null) {
if (other.path != null) {
return false;
}
} else {
if (!path.equals(other.path)) {
return false;
}
}
if (domain == null) {
if (other.domain != null) {
return false;
}
} else {
if (!domain.equals(other.domain)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + name.hashCode();
result = 31 * result + ((value == null) ? 0 : value.hashCode());
result = 31 * result + ((path == null) ? 0 : path.hashCode());
result = 31 * result + ((domain == null) ? 0 : domain.hashCode());
result = 31 * result + version;
return result;
}
public String getDomain() {
return domain;
}
public String getName() {
return name;
}
public String getPath() {
return path;
}
public String getValue() {
return value;
}
public int getVersion() {
return version;
}
private static final HeaderDelegate<Cookie> headerDelegate =
RuntimeDelegate
.getInstance()
.createHeaderDelegate(Cookie.class);
@Override
public String toString() {
return headerDelegate.toString(this);
}
public static Cookie valueOf(String value) {
return headerDelegate.fromString(value);
}
}
| 687 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/UriBuilder.java | /*
* 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 javax.ws.rs.core;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
import javax.ws.rs.ext.RuntimeDelegate;
public abstract class UriBuilder {
protected UriBuilder() {
super();
}
public static UriBuilder fromPath(String value) {
return newInstance().path(value);
}
public static UriBuilder fromResource(Class<?> resourceClass) {
return newInstance().path(resourceClass);
}
public static UriBuilder fromUri(String value) {
try {
return fromUri(new URI(value));
} catch (NullPointerException e) {
throw new IllegalArgumentException(e);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
public static UriBuilder fromUri(URI uri) {
return newInstance().uri(uri);
}
private final static RuntimeDelegate delegate = RuntimeDelegate.getInstance();
protected static UriBuilder newInstance() {
return delegate.createUriBuilder();
}
public abstract URI build(Object... values);
public abstract URI buildFromEncoded(Object... values);
public abstract URI buildFromEncodedMap(Map<String, ? extends Object> values);
public abstract URI buildFromMap(Map<String, ? extends Object> values);
@Override
public abstract UriBuilder clone();
public abstract UriBuilder fragment(String value);
public abstract UriBuilder host(String value);
public abstract UriBuilder matrixParam(String name, Object... values);
public abstract UriBuilder path(Class resourceClass);
public abstract UriBuilder path(Class resourceClass, String resourceMethodName);
public abstract UriBuilder path(Method resourceMethod);
public abstract UriBuilder path(String value);
public abstract UriBuilder port(int port);
public abstract UriBuilder queryParam(String name, Object... values);
public abstract UriBuilder replaceMatrix(String value);
public abstract UriBuilder replaceMatrixParam(String name, Object... values);
public abstract UriBuilder replacePath(String value);
public abstract UriBuilder replaceQuery(String value);
public abstract UriBuilder replaceQueryParam(String name, Object... values);
public abstract UriBuilder scheme(String value);
public abstract UriBuilder schemeSpecificPart(String value);
public abstract UriBuilder segment(String... values);
public abstract UriBuilder uri(URI value);
public abstract UriBuilder userInfo(String value);
}
| 688 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/Request.java | /*
* 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 javax.ws.rs.core;
import java.util.Date;
import java.util.List;
public interface Request {
public Response.ResponseBuilder evaluatePreconditions();
public Response.ResponseBuilder evaluatePreconditions(Date lastModified);
public Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag entityTag);
public Response.ResponseBuilder evaluatePreconditions(EntityTag entityTag);
public String getMethod();
public Variant selectVariant(List<Variant> variants);
}
| 689 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java | /*
* 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 javax.ws.rs.core;
public class UriBuilderException extends RuntimeException {
private static final long serialVersionUID = 956255903370721193L;
public UriBuilderException() {
super();
}
public UriBuilderException(String msg) {
super(msg);
}
public UriBuilderException(String msg, Throwable cause) {
super(msg, cause);
}
public UriBuilderException(Throwable cause) {
super((cause == null ? null : cause.toString()), cause);
}
}
| 690 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java | /*
* 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 javax.ws.rs.ext;
import java.lang.reflect.ReflectPermission;
import java.io.File;
import java.io.IOException;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.Variant;
import org.apache.geronimo.osgi.locator.ProviderLocator;
public abstract class RuntimeDelegate {
public static final String JAXRS_RUNTIME_DELEGATE_PROPERTY = "javax.ws.rs.ext.RuntimeDelegate";
public static interface HeaderDelegate<T> {
public T fromString(String str);
public String toString(T obj);
}
protected RuntimeDelegate() {
// do nothing
}
public abstract <T> T createEndpoint(Application app, java.lang.Class<T> type);
public abstract UriBuilder createUriBuilder();
public abstract Variant.VariantListBuilder createVariantListBuilder();
public abstract <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(Class<T> headerType);
public abstract Response.ResponseBuilder createResponseBuilder();
private static volatile RuntimeDelegate delegate;
public static void setInstance(RuntimeDelegate delegate) throws SecurityException {
SecurityManager secManager = System.getSecurityManager();
if (secManager != null) {
secManager.checkPermission(new ReflectPermission("suppressAccessChecks"));
}
RuntimeDelegate.delegate = delegate;
}
public static RuntimeDelegate getInstance() {
if (delegate != null) {
return delegate;
}
// cannot synchronize on any instance so synchronize on class
synchronized (RuntimeDelegate.class) {
if (delegate != null) {
return delegate;
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// try META-INF/services/javax.ws.rs.ext.RuntimeDelegate
try {
// check the META-INF/services definitions, and return it if
// we find something.
Object service = ProviderLocator.getService(RuntimeDelegate.class.getName(), RuntimeDelegate.class, classLoader);
if (service != null) {
delegate = (RuntimeDelegate)service;
return delegate;
}
} catch (Exception ex) {
// ignore any errors, try additional creation methods
} catch (Error ex) {
// ignore any errors, try additional creation methods
}
String className = null;
try {
// try to read from $java.home/lib/jaxrpc.properties
className = ProviderLocator.lookupByJREPropertyFile("lib" + File.separator + "jaxrpc.properties", RuntimeDelegate.class.getName());
if (className != null) {
Class<?> delegateClass = ProviderLocator.loadClass(className,
RuntimeDelegate.class, classLoader);
delegate = (RuntimeDelegate)delegateClass.newInstance();
return delegate;
}
} catch (IOException e) {
// do nothing
} catch (ClassNotFoundException e) {
// do nothing
} catch (InstantiationException e) {
// do nothing
} catch (IllegalAccessException e) {
// do nothing
}
// try system property
try {
className = System.getProperty("javax.ws.rs.ext.RuntimeDelegate");
} catch (SecurityException e) {
// do nothing
}
// if the system property is null or empty go ahead and use the
// default implementation class name
if (className == null || "".equals(className)) {
// dunno which should be the default. this might be interesting
// for OSGi purposes later to somehow set the
// "current implementation" to be the current default. dunno if
// spec allows for that
className = "org.apache.wink.common.internal.runtime.RuntimeDelegateImpl";
}
try {
Class<?> delegateClass = ProviderLocator.loadClass(className,
RuntimeDelegate.class, classLoader);
delegate = (RuntimeDelegate)delegateClass.newInstance();
return delegate;
} catch (ClassNotFoundException e1) {
// do nothing
} catch (SecurityException e) {
// do nothing
} catch (InstantiationException e) {
// do nothing
} catch (IllegalAccessException e) {
// do nothing
}
throw new RuntimeException("Unable to create jax-rs RuntimeDelegate");
}
}
}
| 691 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/ContextResolver.java | /*
* 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 javax.ws.rs.ext;
public interface ContextResolver<T> {
public T getContext(Class<?> rawType);
}
| 692 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/Provider.java | /*
* 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 javax.ws.rs.ext;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.TYPE)
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface Provider {
}
| 693 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/MessageBodyReader.java | /*
* 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 javax.ws.rs.ext;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
public interface MessageBodyReader<T> {
public boolean isReadable(Class<?> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType);
public T readFrom(Class<T> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String, String> httpHeaders,
InputStream entityStream) throws IOException;
}
| 694 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/MessageBodyWriter.java | /*
* 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 javax.ws.rs.ext;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
public interface MessageBodyWriter<T> {
public long getSize(T t,
Class<?> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType);
public boolean isWriteable(Class<?> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType);
public void writeTo(T t,
Class<?> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException;
}
| 695 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/Providers.java | /*
* 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 javax.ws.rs.ext;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.core.MediaType;
public interface Providers {
public <T> ContextResolver<T> getContextResolver(Class<T> rawType, MediaType mediaType);
public <T extends Throwable> ExceptionMapper<T> getExceptionMapper(Class<T> rawType);
public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType);
public <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> rawType,
Type genericType,
Annotation[] annotations,
MediaType mediaType);
}
| 696 |
0 | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs | Create_ds/geronimo-specs/geronimo-jaxrs_1.1_spec/src/main/java/javax/ws/rs/ext/ExceptionMapper.java | /*
* 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 javax.ws.rs.ext;
import javax.ws.rs.core.Response;
public interface ExceptionMapper<T extends Throwable> {
public Response toResponse(T throwable);
}
| 697 |
0 | Create_ds/geronimo-specs/geronimo-j2ee-management_1.1_spec/src/test/java/javax/management | Create_ds/geronimo-specs/geronimo-j2ee-management_1.1_spec/src/test/java/javax/management/j2ee/ListenerRegistrationTest.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.management.j2ee;
import junit.framework.TestCase;
public class ListenerRegistrationTest extends TestCase {
public void testAddNotificationListener() {
/*@todo implement*/
}
public void testRemoveNotificationListener() {
/*@todo implement*/
}
}
| 698 |
0 | Create_ds/geronimo-specs/geronimo-j2ee-management_1.1_spec/src/main/java/javax/management | Create_ds/geronimo-specs/geronimo-j2ee-management_1.1_spec/src/main/java/javax/management/j2ee/ManagementHome.java | /*
* 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.
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.management.j2ee;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
/**
* @version $Rev$
*/
public interface ManagementHome extends EJBHome {
public Management create() throws CreateException, RemoteException;
} | 699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.