src/share/jaxws_classes/com/sun/xml/internal/ws/server/ServiceDefinitionImpl.java
Print this page
rev 447 : 8029237: Update copyright year to match last edit in jdk8 jaxws repository (2013)
Summary: Fixing Copyrights for year 2013
Reviewed-by: chegar
rev 472 : 8036030: Update JAX-WS RI integration to latest version
*** 1,7 ****
/*
! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 30,39 ****
--- 30,40 ----
import com.sun.xml.internal.ws.api.server.SDDocumentFilter;
import com.sun.xml.internal.ws.api.server.ServiceDefinition;
import com.sun.xml.internal.ws.wsdl.SDDocumentResolver;
import java.util.ArrayList;
+ import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
*** 45,55 ****
* a list of {@link SDDocumentImpl}s.
*
* @author Kohsuke Kawaguchi
*/
public final class ServiceDefinitionImpl implements ServiceDefinition, SDDocumentResolver {
! private final List<SDDocumentImpl> docs;
private final Map<String,SDDocumentImpl> bySystemId;
private final @NotNull SDDocumentImpl primaryWsdl;
/**
--- 46,56 ----
* a list of {@link SDDocumentImpl}s.
*
* @author Kohsuke Kawaguchi
*/
public final class ServiceDefinitionImpl implements ServiceDefinition, SDDocumentResolver {
! private final Collection<SDDocumentImpl> docs;
private final Map<String,SDDocumentImpl> bySystemId;
private final @NotNull SDDocumentImpl primaryWsdl;
/**
*** 63,78 ****
* @param docs
* List of {@link SDDocumentImpl}s to form the description.
* There must be at least one entry.
* The first document is considered {@link #getPrimary() primary}.
*/
! public ServiceDefinitionImpl(List<SDDocumentImpl> docs, @NotNull SDDocumentImpl primaryWsdl) {
assert docs.contains(primaryWsdl);
this.docs = docs;
this.primaryWsdl = primaryWsdl;
- this.bySystemId = new HashMap<String, SDDocumentImpl>(docs.size());
for (SDDocumentImpl doc : docs) {
bySystemId.put(doc.getURL().toExternalForm(),doc);
doc.setFilters(filters);
doc.setResolver(this);
}
--- 64,87 ----
* @param docs
* List of {@link SDDocumentImpl}s to form the description.
* There must be at least one entry.
* The first document is considered {@link #getPrimary() primary}.
*/
! public ServiceDefinitionImpl(Collection<SDDocumentImpl> docs, @NotNull SDDocumentImpl primaryWsdl) {
assert docs.contains(primaryWsdl);
this.docs = docs;
this.primaryWsdl = primaryWsdl;
+ this.bySystemId = new HashMap<String, SDDocumentImpl>();
+ }
+
+ private boolean isInitialized = false;
+
+ private synchronized void init() {
+ if (isInitialized)
+ return;
+ isInitialized = true;
for (SDDocumentImpl doc : docs) {
bySystemId.put(doc.getURL().toExternalForm(),doc);
doc.setFilters(filters);
doc.setResolver(this);
}
*** 93,102 ****
--- 102,112 ----
public void addFilter(SDDocumentFilter filter) {
filters.add(filter);
}
public Iterator<SDDocument> iterator() {
+ init();
return (Iterator)docs.iterator();
}
/**
* Gets the {@link SDDocumentImpl} whose {@link SDDocumentImpl#getURL()}
*** 104,111 ****
--- 114,122 ----
*
* @return
* null if none is found.
*/
public SDDocument resolve(String systemId) {
+ init();
return bySystemId.get(systemId);
}
}