/*=============================================================================*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*=============================================================================*/
package org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.resource.JndiConstants;
import org.apache.ws.resource.Resource;
import org.apache.ws.resource.ResourceContextException;
import org.apache.ws.resource.ResourceException;
import org.apache.ws.resource.ResourceUnknownException;
import org.apache.ws.resource.NamespaceVersionHolder;
import org.apache.ws.resource.impl.AbstractResourceHome;
import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.Map;
/**
* Home for PrinterPort WS-Resources.
*/
public class PrinterPortHome
extends AbstractResourceHome
implements Serializable
{
private static final String SERVICE_NAME = "PrinterPort";
/**
* DOCUMENT_ME
*/
public static final String HOME_LOCATION =
JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
/**
* A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
*/
public static final org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl();
// private PrinterPortResource m_printer;
private int m_printerId;
/**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
*
* @throws ResourceException DOCUMENT_ME
* @throws ResourceContextException DOCUMENT_ME
* @throws ResourceUnknownException DOCUMENT_ME
*/
public Resource createPrinter()
throws ResourceException,
ResourceContextException,
ResourceUnknownException
{
++m_printerId;
String printerId = "Printer" + m_printerId;
EndpointReference printerEpr = getEndpointReference( printerId );
PrinterPortResource printer = new PrinterPortResource( "Printer" + printerId, printerEpr );
printer.init();
add( printer );
return printer;
}
public QName getServiceName()
{
return new QName( PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "PrinterPort" );
}
public QName getPortType()
{
return new QName( PrinterPortPropertyQNames.PRINTER_REFERENCE.getNamespaceURI(), "Printer" );
}
public String getServicePortName()
{
return "PrinterPort";
}
public NamespaceVersionHolder getNamespaceSet()
{
return SPEC_NAMESPACE_SET;
}
/**
* Map containing all SushiResource instances - this map <em>must</em> be static for
* compatibility with certain JNDI providers.
*/
private static Map s_resources;
/**
* Returns a map of all SushiResource instances. Used by the {@link AbstractResourceHome}
* superclass.
*/
protected synchronized final Map getResourceMap()
{
if ( s_resources == null )
{
s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
}
return s_resources;
}
}