001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: package com.sun.xml.ws.tx.coordinator;
037:
038: import com.sun.xml.ws.developer.MemberSubmissionEndpointReference;
039: import com.sun.xml.ws.tx.webservice.member.coord.CoordinationContext;
040: import com.sun.xml.ws.tx.webservice.member.coord.CoordinationContextType.Identifier;
041: import com.sun.xml.ws.tx.webservice.member.coord.Expires;
042: import com.sun.istack.NotNull;
043:
044: import javax.xml.namespace.QName;
045: import javax.xml.ws.EndpointReference;
046: import java.util.Map;
047:
048: /**
049: * This class encapsulates the genertated 2004/10 version of {@link com.sun.xml.ws.tx.webservice.member.coord.CoordinationContextType}
050: *
051: * @author Ryan.Shoemaker@Sun.COM
052: * @version $Revision: 1.5 $
053: * @since 1.0
054: */
055: public class CoordinationContext200410 extends CoordinationContextBase {
056: CoordinationContext context;
057:
058: public CoordinationContext200410() {
059: context = new CoordinationContext();
060: }
061:
062: /**
063: * wrapper around JAXB generated CoordinationContext type
064: * @param cc coordination context
065: */
066: public CoordinationContext200410(@NotNull
067: CoordinationContext cc) {
068: context = cc;
069: }
070:
071: @NotNull
072: public String getIdentifier() {
073: return context.getIdentifier().getValue();
074: }
075:
076: public void setIdentifier(@NotNull
077: final String identifier) {
078: final Identifier id = new Identifier();
079: id.setValue(identifier);
080: context.setIdentifier(id);
081: }
082:
083: public long getExpires() {
084: final Expires exp = context.getExpires();
085: if (exp == null) {
086: return 0L;
087: } else {
088: return exp.getValue();
089: }
090: }
091:
092: public void setExpires(final long expires) {
093: if (expires <= 0L) {
094: context.setExpires(null);
095: } else {
096: final Expires exp = new Expires();
097: exp.setValue(expires);
098: context.setExpires(exp);
099: }
100: }
101:
102: @NotNull
103: public String getCoordinationType() {
104: return context.getCoordinationType();
105: }
106:
107: public void setCoordinationType(@NotNull
108: final String coordinationType) {
109: context.setCoordinationType(coordinationType);
110: }
111:
112: @NotNull
113: public EndpointReference getRegistrationService() {
114: return context.getRegistrationService();
115: }
116:
117: public void setRegistrationService(@NotNull
118: final EndpointReference registrationService) {
119: context
120: .setRegistrationService((MemberSubmissionEndpointReference) registrationService);
121: }
122:
123: public Object getValue() {
124: return context;
125: }
126:
127: public Map<QName, String> getOtherAttributes() {
128: return context.getOtherAttributes();
129: }
130:
131: }
|