You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2005/02/25 17:09:50 UTC
svn commit: r155339 [2/2] -
incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortService.java Fri Feb 25 08:09:44 2005
@@ -1,3 +1,18 @@
+/*=============================================================================*
+ * 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.resource.ResourceContext;
@@ -7,16 +22,9 @@
import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.xmlbeans.XmlObject;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.DocumentContentType;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.DocumentFormatSupportedDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.JobPrinterReferenceDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypeType;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypes;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.SendDocumentRequestDocument;
+import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.*;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
-
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
@@ -31,112 +39,129 @@
* calls to the code generator.
*/
public class JobPortService
- extends AbstractJobPortService
- implements JobPortCustomOperationsPortType
+ extends AbstractJobPortService
+ implements JobPortCustomOperationsPortType
{
+ private ResourceContext m_resourceContext;
- private ResourceContext m_resourceContext;
-
- /**
- * Creates a new {@link JobPortService } object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public JobPortService(ResourceContext resourceContext)
- {
- m_resourceContext = resourceContext;
- init();
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourceContext getResourceContext()
- {
- return m_resourceContext;
- }
-
-
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Send_Document(org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.SendDocumentRequestDocument requestDoc)
- {
- CreationResponseDocument responseDoc = createResponseDocument();
- CreationResponseDocument.CreationResponse creationResponse = responseDoc.getCreationResponse();
- SendDocumentRequestDocument.SendDocumentRequest sendDocumentRequest = requestDoc.getSendDocumentRequest();
- DocumentContentType documentContent = sendDocumentRequest.getDocumentContent();
- String documentFormat = sendDocumentRequest.getDocumentFormat();
- boolean lastDocument = sendDocumentRequest.getLastDocument();
- try
- {
- if(isDocTypeSupported(documentFormat))
- {
- JobPortResource jobResource = (JobPortResource) getResourceContext().getResource();
- org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = jobResource.getResourcePropertySet();
- //todo ok this just means we add to document to be printed...need some representation or something
- //also if is last document..probably change its state or something
- }
- else
- {
- creationResponse.setSuccessStatusCode("server-error-internal-error");
- }
- }
- catch (Exception e)
- {
- //throw something
- }
-
- return responseDoc;
- }
-
- private CreationResponseDocument createResponseDocument()
- {
- CreationResponseDocument creationResponseDocument = CreationResponseDocument.Factory.newInstance();
- creationResponseDocument.addNewCreationResponse();
- return creationResponseDocument;
- }
-
- private boolean isDocTypeSupported(String documentFormat)
- throws ResourceContextException, ResourceException
- {
- //not sure if over engineering here
- boolean docTypeSupported = false;
- JobPortResource jobPortResource = (JobPortResource) getResourceContext().getResource();
- XmlBeansResourceProperty xmlProp = (XmlBeansResourceProperty) jobPortResource.getResourcePropertySet().get(JobPortPropertyQNames.JOB_PRINTER_REFERENCE);
- JobPrinterReferenceDocument printRef = (JobPrinterReferenceDocument) xmlProp.get(0);
- EndpointReferenceType jobPrinterReference = printRef.getJobPrinterReference();
- ReferencePropertiesType referenceProperties = jobPrinterReference.getReferenceProperties();
- QName keyQName = QName.valueOf("{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID)");
- XmlObject[] childElements = XmlBeanUtils.getChildElements(referenceProperties, keyQName);
- String value = XmlBeanUtils.getValue(childElements[0]); //todo check this
- SimpleTypeResourceKey key = new SimpleTypeResourceKey(keyQName, value);
- try
- {
- InitialContext ctx = new InitialContext();
- PrinterPortHome home = (PrinterPortHome) ctx.lookup(PrinterPortHome.HOME_LOCATION);
- PrinterPortResource printResource = (PrinterPortResource) home.find(key);
- XmlBeansResourceProperty xmlPropDocFormat = (XmlBeansResourceProperty) printResource.getResourcePropertySet().get(PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED);
- DocumentFormatSupportedDocument docsSupported = (DocumentFormatSupportedDocument) xmlPropDocFormat.toXmlObjects()[0];
- MimeMediaTypes documentFormatSupported = docsSupported.getDocumentFormatSupported();
- MimeMediaTypeType.Enum[] mimeMediaTypeArray = documentFormatSupported.getMimeMediaTypeArray();
-
- //todo chekc that the equals check really works
- for (int i = 0; i < mimeMediaTypeArray.length; i++)
+ /**
+ * Creates a new {@link JobPortService } object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public JobPortService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceContext getResourceContext( )
+ {
+ return m_resourceContext;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Send_Document( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.SendDocumentRequestDocument requestDoc )
+ {
+ CreationResponseDocument responseDoc = createResponseDocument( );
+ CreationResponseDocument.CreationResponse creationResponse = responseDoc.getCreationResponse( );
+ SendDocumentRequestDocument.SendDocumentRequest sendDocumentRequest = requestDoc.getSendDocumentRequest( );
+ DocumentContentType documentContent =
+ sendDocumentRequest.getDocumentContent( );
+ String documentFormat =
+ sendDocumentRequest.getDocumentFormat( );
+ boolean lastDocument =
+ sendDocumentRequest.getLastDocument( );
+ try
+ {
+ if ( isDocTypeSupported( documentFormat ) )
+ {
+ JobPortResource jobResource =
+ (JobPortResource) getResourceContext( ).getResource( );
+ org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet =
+ jobResource.getResourcePropertySet( );
+
+ //todo ok this just means we add to document to be printed...need some representation or something
+ //also if is last document..probably change its state or something
+ }
+ else
+ {
+ creationResponse.setSuccessStatusCode( "server-error-internal-error" );
+ }
+ }
+ catch ( Exception e )
+ {
+ //throw something
+ }
+
+ return responseDoc;
+ }
+
+ private boolean isDocTypeSupported( String documentFormat )
+ throws ResourceContextException,
+ ResourceException
+ {
+ //not sure if over engineering here
+ boolean docTypeSupported = false;
+ JobPortResource jobPortResource = (JobPortResource) getResourceContext( ).getResource( );
+ XmlBeansResourceProperty xmlProp =
+ (XmlBeansResourceProperty) jobPortResource.getResourcePropertySet( ).get( JobPortPropertyQNames.JOB_PRINTER_REFERENCE );
+ JobPrinterReferenceDocument printRef = (JobPrinterReferenceDocument) xmlProp.get( 0 );
+ EndpointReferenceType jobPrinterReference = printRef.getJobPrinterReference( );
+ ReferencePropertiesType referenceProperties = jobPrinterReference.getReferenceProperties( );
+ QName keyQName =
+ QName.valueOf( "{http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.wsdl}ResourceID)" );
+ XmlObject[] childElements =
+ XmlBeanUtils.getChildElements( referenceProperties, keyQName );
+ String value = XmlBeanUtils.getValue( childElements[0] ); //todo check this
+ SimpleTypeResourceKey key = new SimpleTypeResourceKey( keyQName, value );
+ try
+ {
+ InitialContext ctx = new InitialContext( );
+ PrinterPortHome home =
+ (PrinterPortHome) ctx.lookup( PrinterPortHome.HOME_LOCATION );
+ PrinterPortResource printResource = (PrinterPortResource) home.find( key );
+ XmlBeansResourceProperty xmlPropDocFormat =
+ (XmlBeansResourceProperty) printResource.getResourcePropertySet( ).get( PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED );
+ DocumentFormatSupportedDocument docsSupported =
+ (DocumentFormatSupportedDocument) xmlPropDocFormat.toXmlObjects( )[0];
+ MimeMediaTypes documentFormatSupported = docsSupported.getDocumentFormatSupported( );
+ MimeMediaTypeType.Enum[] mimeMediaTypeArray =
+ documentFormatSupported.getMimeMediaTypeArray( );
+
+ //todo chekc that the equals check really works
+ for ( int i = 0; i < mimeMediaTypeArray.length; i++ )
+ {
+ MimeMediaTypeType.Enum enum = mimeMediaTypeArray[i];
+ if ( enum.equals( documentFormat ) )
{
- MimeMediaTypeType.Enum enum = mimeMediaTypeArray[i];
- if (enum.equals(documentFormat))
- {
- docTypeSupported = true;
- }
+ docTypeSupported = true;
}
- }
- catch (NamingException e)
- {
- //throw something!!
- }
-
-
- return docTypeSupported;
- }
-
-}
+ }
+ }
+ catch ( NamingException e )
+ {
+ //throw something!!
+ }
+
+ return docTypeSupported;
+ }
+
+ private CreationResponseDocument createResponseDocument( )
+ {
+ CreationResponseDocument creationResponseDocument = CreationResponseDocument.Factory.newInstance( );
+ creationResponseDocument.addNewCreationResponse( );
+ return creationResponseDocument;
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryCustomOperationsPortType.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryCustomOperationsPortType.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryCustomOperationsPortType.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryCustomOperationsPortType.java Fri Feb 25 08:09:44 2005
@@ -1,6 +1,21 @@
-
+/*=============================================================================*
+ * 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;
+
/**
* Custom operations portType.
*
@@ -9,7 +24,12 @@
*/
public interface PrinterFactoryCustomOperationsPortType
{
-
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument CreatePrinter( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterRequestDocument requestDoc ) ;
-
-}
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument CreatePrinter( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterRequestDocument requestDoc );
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryHome.java Fri Feb 25 08:09:44 2005
@@ -1,48 +1,56 @@
+/*=============================================================================*
+ * 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.resource.Resource;
-import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceContextException;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceKey;
-import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.*;
import org.apache.ws.resource.impl.AbstractResourceHome;
-
import java.io.Serializable;
/**
* Home for PrinterFactory WS-Resources.
*/
public class PrinterFactoryHome
- extends AbstractResourceHome
- implements Serializable
+ extends AbstractResourceHome
+ implements Serializable
{
- private PrinterFactoryResource m_printerFactory;
-
- /**
- * TODO
- *
- * @param resourceContext DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- *
- * @throws ResourceException DOCUMENT_ME
- * @throws ResourceContextException DOCUMENT_ME
- * @throws ResourceUnknownException DOCUMENT_ME
- */
- public Resource getInstance( ResourceContext resourceContext )
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- //singleton
- if(m_printerFactory == null)
- {
- m_printerFactory = new PrinterFactoryResource();
- m_printerFactory.init();
- }
-
- return m_printerFactory;
- }
+ private PrinterFactoryResource m_printerFactory;
-}
+ /**
+ * TODO
+ *
+ * @param resourceContext DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws ResourceException DOCUMENT_ME
+ * @throws ResourceContextException DOCUMENT_ME
+ * @throws ResourceUnknownException DOCUMENT_ME
+ */
+ public Resource getInstance( ResourceContext resourceContext )
+ throws ResourceException,
+ ResourceContextException,
+ ResourceUnknownException
+ {
+ //singleton
+ if ( m_printerFactory == null )
+ {
+ m_printerFactory = new PrinterFactoryResource( );
+ m_printerFactory.init( );
+ }
+
+ return m_printerFactory;
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryResource.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryResource.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryResource.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryResource.java Fri Feb 25 08:09:44 2005
@@ -1,21 +1,34 @@
-
+/*=============================================================================*
+ * 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;
+
/**
* A PrinterFactory WS-Resource.
* <p/>
* NOTE: This class is generated but IS meant to be modified.
*/
-public class PrinterFactoryResource extends AbstractPrinterFactoryResource
-
+public class PrinterFactoryResource
+ extends AbstractPrinterFactoryResource
{
-
- /**
- * Initializes this resource's state (properties, etc.).
- */
- public void init()
- {
- super.init();
- }
-
-}
+ /**
+ * Initializes this resource's state (properties, etc.).
+ */
+ public void init( )
+ {
+ super.init( );
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryService.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryService.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryService.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactoryService.java Fri Feb 25 08:09:44 2005
@@ -1,23 +1,29 @@
+/*=============================================================================*
+ * 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.resource.ResourceContext;
import org.apache.ws.resource.ResourceUnknownException;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceContextException;
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
import org.apache.ws.resource.properties.faults.ResourceUnknownFaultException;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
import org.apache.ws.resource.properties.v1_2_draft05.porttype.impl.NamespaceVersionHolderImpl;
-import org.apache.ws.util.jndi.JNDIUtils;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlException;
import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-
-import javax.xml.rpc.JAXRPCException;
import javax.naming.Context;
import javax.naming.InitialContext;
-import javax.naming.NamingException;
/**
* This class should be generated ONCE (and not overwritten) to maintain user-added code.
@@ -30,10 +36,9 @@
*
*/
public class PrinterFactoryService
- extends AbstractPrinterFactoryService
+ extends AbstractPrinterFactoryService
implements PrinterFactoryCustomOperationsPortType
{
-
private ResourceContext m_resourceContext;
/**
@@ -44,7 +49,7 @@
public PrinterFactoryService( ResourceContext resourceContext )
{
m_resourceContext = resourceContext;
- init();
+ init( );
}
/**
@@ -57,35 +62,53 @@
return m_resourceContext;
}
-
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument CreatePrinter( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterRequestDocument requestDoc )
{
- CreatePrinterResponseDocument responseDocument = createResponseDocument();
- CreatePrinterResponseDocument.CreatePrinterResponse createPrinterResponse = responseDocument.getCreatePrinterResponse();
- try
- {
- Context initialContext = new InitialContext( );
- PrinterPortHome printerPortHome = (PrinterPortHome) initialContext.lookup( PrinterPortHome.HOME_LOCATION );
- PrinterPortResource instance = (PrinterPortResource) printerPortHome.createPrinter(getResourceContext());
-
- //get Resource Prop for Printer Ref
- XmlBeansResourceProperty prop = (XmlBeansResourceProperty) instance.getResourcePropertySet().get(PrinterPortPropertyQNames.PRINTER_REFERENCE);
- //set the Printer EPR on the response
- createPrinterResponse.setPrinterReference((EndpointReferenceType) prop.toXmlObjects()[0]);
- }
- catch (Exception e)
- {
- throw new ResourceUnknownFaultException(new NamespaceVersionHolderImpl(),new ResourceUnknownException(null,"An error occurred when invoking CreatePrinter"));
- }
+ CreatePrinterResponseDocument responseDocument = createResponseDocument( );
+ CreatePrinterResponseDocument.CreatePrinterResponse createPrinterResponse =
+ responseDocument.getCreatePrinterResponse( );
+ try
+ {
+ Context initialContext = new InitialContext( );
+ PrinterPortHome printerPortHome =
+ (PrinterPortHome) initialContext.lookup( PrinterPortHome.HOME_LOCATION );
+ PrinterPortResource instance =
+ (PrinterPortResource) printerPortHome.createPrinter( getResourceContext( ) );
+
+ //get Resource Prop for Printer Ref
+ XmlBeansResourceProperty prop =
+ (XmlBeansResourceProperty) instance.getResourcePropertySet( ).get( PrinterPortPropertyQNames.PRINTER_REFERENCE );
+
+ //set the Printer EPR on the response
+ createPrinterResponse.setPrinterReference( (EndpointReferenceType) prop.toXmlObjects( )[0] );
+ }
+ catch ( Exception e )
+ {
+ throw new ResourceUnknownFaultException( new NamespaceVersionHolderImpl( ),
+ new ResourceUnknownException( null,
+ "An error occurred when invoking CreatePrinter" ) );
+ }
- return responseDocument;
+ return responseDocument;
}
-
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument createResponseDocument()
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument createResponseDocument( )
{
- org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument response =
- org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument.Factory.newInstance();
- response.addNewCreatePrinterResponse();
- return response;
+ org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument response =
+ org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreatePrinterResponseDocument.Factory.newInstance( );
+ response.addNewCreatePrinterResponse( );
+ return response;
}
-}
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortCustomOperationsPortType.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortCustomOperationsPortType.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortCustomOperationsPortType.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortCustomOperationsPortType.java Fri Feb 25 08:09:44 2005
@@ -1,6 +1,21 @@
-
+/*=============================================================================*
+ * 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;
+
/**
* Custom operations portType.
*
@@ -9,8 +24,21 @@
*/
public interface PrinterPortCustomOperationsPortType
{
-
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Create_Job( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreateJobRequestDocument requestDoc ) ;
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Print_Job( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrintJobRequestDocument requestDoc ) ;
-
-}
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Create_Job( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreateJobRequestDocument requestDoc );
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Print_Job( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrintJobRequestDocument requestDoc );
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortHome.java Fri Feb 25 08:09:44 2005
@@ -1,72 +1,105 @@
+/*=============================================================================*
+ * 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.resource.JndiConstants;
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceContextException;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.*;
import org.apache.ws.resource.impl.AbstractResourceHome;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-
import java.io.Serializable;
/**
* Home for PrinterPort WS-Resources.
*/
public class PrinterPortHome
- extends AbstractResourceHome
- implements Serializable
+ extends AbstractResourceHome
+ implements Serializable
{
- private static final String SERVICE_NAME = "PrinterPort";
- public static final String HOME_LOCATION = JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
- private PrinterPortResource m_printer;
-
- /**
- * @param resourceContext DOCUMENT_ME
- * @return DOCUMENT_ME
- * @throws ResourceException DOCUMENT_ME
- * @throws ResourceContextException DOCUMENT_ME
- * @throws ResourceUnknownException DOCUMENT_ME
- */
- public Resource getInstance(ResourceContext resourceContext)
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- //singleton
- if (m_printer == null)
- {
- throw new ResourceUnknownException(null, SERVICE_NAME);
- }
- return m_printer;
- }
-
- public Resource createPrinter(ResourceContext resourceContext)
- throws ResourceException,
- ResourceContextException,
- ResourceUnknownException
- {
- //singleton
- if (m_printer == null)
- {
- m_printer = new PrinterPortResource("Printer1", getPrinterEpr(resourceContext.getBaseURL()));
- m_printer.init();
- }
- return m_printer;
- }
-
-
- public EndpointReferenceType getPrinterEpr(String serviceUrl)
- {
- EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance();
- EndpointReferenceType epr = eprDoc.addNewEndpointReference();
- AttributedURI address = epr.addNewAddress();
-
- address.setStringValue(serviceUrl + SERVICE_NAME);
- // TODO: set portType and serviceName! (read from config file)
- return epr;
- }
-}
+ 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;
+ private PrinterPortResource m_printer;
+
+ /**
+ * @param resourceContext DOCUMENT_ME
+ * @return DOCUMENT_ME
+ * @throws ResourceException DOCUMENT_ME
+ * @throws ResourceContextException DOCUMENT_ME
+ * @throws ResourceUnknownException DOCUMENT_ME
+ */
+ public Resource getInstance( ResourceContext resourceContext )
+ throws ResourceException,
+ ResourceContextException,
+ ResourceUnknownException
+ {
+ //singleton
+ if ( m_printer == null )
+ {
+ throw new ResourceUnknownException( null, SERVICE_NAME );
+ }
+
+ return m_printer;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param serviceUrl DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public EndpointReferenceType getPrinterEpr( String serviceUrl )
+ {
+ EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance( );
+ EndpointReferenceType epr = eprDoc.addNewEndpointReference( );
+ AttributedURI address = epr.addNewAddress( );
+
+ address.setStringValue( serviceUrl + SERVICE_NAME );
+
+ // TODO: set portType and serviceName! (read from config file)
+ return epr;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resourceContext DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws ResourceException DOCUMENT_ME
+ * @throws ResourceContextException DOCUMENT_ME
+ * @throws ResourceUnknownException DOCUMENT_ME
+ */
+ public Resource createPrinter( ResourceContext resourceContext )
+ throws ResourceException,
+ ResourceContextException,
+ ResourceUnknownException
+ {
+ //singleton
+ if ( m_printer == null )
+ {
+ m_printer = new PrinterPortResource( "Printer1",
+ getPrinterEpr( resourceContext.getBaseURL( ) ) );
+ m_printer.init( );
+ }
+
+ return m_printer;
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortPropertyQNames.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortPropertyQNames.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortPropertyQNames.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortPropertyQNames.java Fri Feb 25 08:09:44 2005
@@ -1,3 +1,18 @@
+/*=============================================================================*
+ * 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 javax.xml.namespace.QName;
@@ -10,26 +25,52 @@
*/
public interface PrinterPortPropertyQNames
{
-
- QName PRINTER_STATE =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_state", "wsrf-pr");
- QName PRINTER_NAME =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_name", "wsrf-pr");
- QName JOB_PROPERTIES =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "job_properties", "wsrf-pr");
- QName DOCUMENT_FORMAT_SUPPORTED =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "document_format_supported", "wsrf-pr");
- QName JOB_HOLD_UNTIL_SUPPORTED =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "job_hold_until_supported", "wsrf-pr");
- QName QUEUED_JOB_COUNT =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "queued_job_count", "wsrf-pr");
- QName JOB_HOLD_UNTIL_DEFAULT =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "job_hold_until_default", "wsrf-pr");
- QName OPERATIONS_SUPPORTED =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "operations_supported", "wsrf-pr");
- QName PRINTER_IS_ACCEPTING_JOBS =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_is_accepting_jobs", "wsrf-pr");
- QName PRINTER_REFERENCE =
- new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_reference", "wsrf-pr");
-
-}
+ /** DOCUMENT_ME */
+ QName PRINTER_STATE =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_state",
+ "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName PRINTER_NAME =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_name", "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName JOB_PROPERTIES =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "job_properties",
+ "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName DOCUMENT_FORMAT_SUPPORTED =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd",
+ "document_format_supported", "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName JOB_HOLD_UNTIL_SUPPORTED =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd",
+ "job_hold_until_supported", "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName QUEUED_JOB_COUNT =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "queued_job_count",
+ "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName JOB_HOLD_UNTIL_DEFAULT =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd",
+ "job_hold_until_default", "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName OPERATIONS_SUPPORTED =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "operations_supported",
+ "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName PRINTER_IS_ACCEPTING_JOBS =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd",
+ "printer_is_accepting_jobs", "wsrf-pr" );
+
+ /** DOCUMENT_ME */
+ QName PRINTER_REFERENCE =
+ new QName( "http://docs.oasis-open.org/wsrf/2005/01/wsrf-Interop-2.0-draft-03.xsd", "printer_reference",
+ "wsrf-pr" );
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortResource.java Fri Feb 25 08:09:44 2005
@@ -1,95 +1,108 @@
-
+/*=============================================================================*
+ * 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.resource.properties.ResourceProperty;
-import org.apache.ws.resource.properties.query.QueryConstants;
-import org.apache.ws.resource.properties.v1_2_draft05.porttype.QueryResourcePropertiesPortType;
-import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryExpressionDialectDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.DocumentFormatSupportedDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypeType;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypes;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.Operations;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.OperationsSupportedDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrinterIsAcceptingJobsDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrinterNameDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrinterReferenceDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.QueuedJobCountDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrinterStateDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrinterStateType;
+import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.*;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-
import java.math.BigInteger;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
/**
* A PrinterPort WS-Resource.
* <p/>
* NOTE: This class is generated but IS meant to be modified.
*/
-public class PrinterPortResource extends AbstractPrinterPortResource
-
+public class PrinterPortResource
+ extends AbstractPrinterPortResource
{
- private String m_name;
- private EndpointReferenceType m_epr;
+ private String m_name;
+ private EndpointReferenceType m_epr;
- public PrinterPortResource(String name, EndpointReferenceType eprForResource)
- {
- m_name = name;
- m_epr = eprForResource;
- }
-
- /**
- * Initializes this resource's state (properties, etc.).
- */
- public void init()
- {
- super.init();
- ResourceProperty resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_REFERENCE);
- PrinterReferenceDocument printerRefDoc = PrinterReferenceDocument.Factory.newInstance();
- printerRefDoc.setPrinterReference(getEpr());
- resourceProperty.add(printerRefDoc);
-
- resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_STATE);
- PrinterStateDocument printerState = PrinterStateDocument.Factory.newInstance();
- printerState.setPrinterState(PrinterStateType.IDLE);
- resourceProperty.add(printerState);
-
- resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_NAME);
- PrinterNameDocument printName = PrinterNameDocument.Factory.newInstance();
- printName.setPrinterName(m_name);
- resourceProperty.add(printName);
-
- resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_IS_ACCEPTING_JOBS);
- PrinterIsAcceptingJobsDocument isAccepting = PrinterIsAcceptingJobsDocument.Factory.newInstance();
- isAccepting.setPrinterIsAcceptingJobs(false);
- resourceProperty.add(isAccepting);
-
- resourceProperty = m_propSet.get(PrinterPortPropertyQNames.QUEUED_JOB_COUNT);
- QueuedJobCountDocument queuedJobCountDocument = QueuedJobCountDocument.Factory.newInstance();
- queuedJobCountDocument.setQueuedJobCount(BigInteger.valueOf(0));
- resourceProperty.add(queuedJobCountDocument);
-
- resourceProperty = m_propSet.get(PrinterPortPropertyQNames.OPERATIONS_SUPPORTED);
- OperationsSupportedDocument operationsSupportedDocument = OperationsSupportedDocument.Factory.newInstance();
- List operationsSupported = new ArrayList();
- operationsSupported.add(Operations.PRINT_JOB); //refer to doc...
- operationsSupported.add(Operations.CREATE_JOB); //refer to doc...
- operationsSupported.add(Operations.SEND_DOCUMENT); //refer to doc...
- operationsSupportedDocument.setOperationsSupported(operationsSupported);
- resourceProperty.add(operationsSupportedDocument);
-
- resourceProperty = m_propSet.get(PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED);
- DocumentFormatSupportedDocument documentFormatSupportedDocument = DocumentFormatSupportedDocument.Factory.newInstance();
- MimeMediaTypes mimeMediaTypes = documentFormatSupportedDocument.addNewDocumentFormatSupported();
- mimeMediaTypes.addMimeMediaType(MimeMediaTypeType.TEXT_PLAIN);
- resourceProperty.add(documentFormatSupportedDocument);
-
- }
-
- public EndpointReferenceType getEpr( )
- {
- return m_epr;
- }
-}
+ /**
+ * Creates a new {@link PrinterPortResource} object.
+ *
+ * @param name DOCUMENT_ME
+ * @param eprForResource DOCUMENT_ME
+ */
+ public PrinterPortResource( String name,
+ EndpointReferenceType eprForResource )
+ {
+ m_name = name;
+ m_epr = eprForResource;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public EndpointReferenceType getEpr( )
+ {
+ return m_epr;
+ }
+
+ /**
+ * Initializes this resource's state (properties, etc.).
+ */
+ public void init( )
+ {
+ super.init( );
+ ResourceProperty resourceProperty = m_propSet.get( PrinterPortPropertyQNames.PRINTER_REFERENCE );
+ PrinterReferenceDocument printerRefDoc = PrinterReferenceDocument.Factory.newInstance( );
+ printerRefDoc.setPrinterReference( getEpr( ) );
+ resourceProperty.add( printerRefDoc );
+
+ resourceProperty = m_propSet.get( PrinterPortPropertyQNames.PRINTER_STATE );
+ PrinterStateDocument printerState = PrinterStateDocument.Factory.newInstance( );
+ printerState.setPrinterState( PrinterStateType.IDLE );
+ resourceProperty.add( printerState );
+
+ resourceProperty = m_propSet.get( PrinterPortPropertyQNames.PRINTER_NAME );
+ PrinterNameDocument printName = PrinterNameDocument.Factory.newInstance( );
+ printName.setPrinterName( m_name );
+ resourceProperty.add( printName );
+
+ resourceProperty = m_propSet.get( PrinterPortPropertyQNames.PRINTER_IS_ACCEPTING_JOBS );
+ PrinterIsAcceptingJobsDocument isAccepting = PrinterIsAcceptingJobsDocument.Factory.newInstance( );
+ isAccepting.setPrinterIsAcceptingJobs( false );
+ resourceProperty.add( isAccepting );
+
+ resourceProperty = m_propSet.get( PrinterPortPropertyQNames.QUEUED_JOB_COUNT );
+ QueuedJobCountDocument queuedJobCountDocument = QueuedJobCountDocument.Factory.newInstance( );
+ queuedJobCountDocument.setQueuedJobCount( BigInteger.valueOf( 0 ) );
+ resourceProperty.add( queuedJobCountDocument );
+
+ resourceProperty = m_propSet.get( PrinterPortPropertyQNames.OPERATIONS_SUPPORTED );
+ OperationsSupportedDocument operationsSupportedDocument =
+ OperationsSupportedDocument.Factory.newInstance( );
+ List operationsSupported = new ArrayList( );
+ operationsSupported.add( Operations.PRINT_JOB ); //refer to doc...
+ operationsSupported.add( Operations.CREATE_JOB ); //refer to doc...
+ operationsSupported.add( Operations.SEND_DOCUMENT ); //refer to doc...
+ operationsSupportedDocument.setOperationsSupported( operationsSupported );
+ resourceProperty.add( operationsSupportedDocument );
+
+ resourceProperty = m_propSet.get( PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED );
+ DocumentFormatSupportedDocument documentFormatSupportedDocument =
+ DocumentFormatSupportedDocument.Factory.newInstance( );
+ MimeMediaTypes mimeMediaTypes =
+ documentFormatSupportedDocument.addNewDocumentFormatSupported( );
+ mimeMediaTypes.addMimeMediaType( MimeMediaTypeType.TEXT_PLAIN );
+ resourceProperty.add( documentFormatSupportedDocument );
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortService.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortService.java?view=diff&r1=155338&r2=155339
==============================================================================
--- incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortService.java (original)
+++ incubator/apollo/trunk/src/site/content/example/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPortService.java Fri Feb 25 08:09:44 2005
@@ -1,3 +1,18 @@
+/*=============================================================================*
+ * 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.resource.ResourceContext;
@@ -8,16 +23,8 @@
import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
import org.apache.xmlbeans.XmlBoolean;
import org.apache.xmlbeans.XmlInteger;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreateJobRequestDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.DocumentContentType;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.JobPropertiesDocument;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.JobStateType;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypeType;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.MimeMediaTypes;
-import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrintJobRequestDocument;
+import org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.*;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-
import javax.naming.Context;
import javax.naming.InitialContext;
import java.math.BigInteger;
@@ -33,203 +40,241 @@
* calls to the code generator.
*/
public class PrinterPortService
- extends AbstractPrinterPortService
- implements PrinterPortCustomOperationsPortType
+ extends AbstractPrinterPortService
+ implements PrinterPortCustomOperationsPortType
{
+ private ResourceContext m_resourceContext;
- private ResourceContext m_resourceContext;
-
- /**
- * Creates a new {@link PrinterPortService } object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public PrinterPortService(ResourceContext resourceContext)
- {
- m_resourceContext = resourceContext;
- init();
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourceContext getResourceContext()
- {
- return m_resourceContext;
- }
-
-
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Create_Job(org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreateJobRequestDocument requestDoc)
- {
- CreationResponseDocument responseDocument = createResponseDocument();
- CreationResponseDocument.CreationResponse creationResponse = responseDocument.getCreationResponse();
- JobPortResource jobResource = null;
-
- if(isAcceptingJobs())
- {
- try
- {
- Context initialContext = new InitialContext();
- JobPortHome home = (JobPortHome) initialContext.lookup(JobPortHome.HOME_LOCATION);
- CreateJobRequestDocument.CreateJobRequest createJobRequest = requestDoc.getCreateJobRequest();
- String jobName = createJobRequest.getJobName();
- jobResource = (JobPortResource) home.createJob(getResourceContext(), jobName,getResourceEpr());
- Calendar currentTime = jobResource.getCurrentTime();
- Calendar termTime = Calendar.getInstance();
- termTime.set(currentTime.get(Calendar.YEAR),currentTime.get(Calendar.MONTH), currentTime.get(Calendar.DATE), currentTime.get(Calendar.HOUR), currentTime.get(Calendar.MINUTE) + 4 );
- jobResource.setTerminationTime(termTime);
- addJobPropsToPrinterProps(jobResource);
- incrementQueueCount();
- addJobInfoToResponse(jobResource, creationResponse);
-
- }
- catch (Exception e)
- {
- creationResponse.setSuccessStatusCode("server-error-internal-error");
- }
-
- }
- else
- {
- //throw custom client fault
- }
- return responseDocument;
- }
-
- private void incrementQueueCount() throws ResourceException, ResourceContextException
- {
- PrinterPortResource printerResource = (PrinterPortResource) getResourceContext().getResource();
- ResourceProperty printerJobProperties = printerResource.getResourcePropertySet().get(PrinterPortPropertyQNames.QUEUED_JOB_COUNT);
- XmlInteger queued = (XmlInteger) printerJobProperties.get(0);
- BigInteger bigIntegerValue = queued.getBigIntegerValue();
- int count = bigIntegerValue.intValue();
- count++;
- queued.setBigIntegerValue(BigInteger.valueOf(count));
- }
-
- private void addJobPropsToPrinterProps(JobPortResource instance)
- throws ResourceContextException, ResourceException
- {
- JobPropertiesDocument jobPropDoc = getJobPropDoc(instance);
- PrinterPortResource printerResource = (PrinterPortResource) getResourceContext().getResource();
- ResourceProperty printerJobProperties = printerResource.getResourcePropertySet().get(PrinterPortPropertyQNames.JOB_PROPERTIES);
- printerJobProperties.add(jobPropDoc);
- }
-
- private JobPropertiesDocument getJobPropDoc(JobPortResource instance)
- {
- XmlBeansResourcePropertySet propSet = (XmlBeansResourcePropertySet) instance.getResourcePropertySet();
- return (JobPropertiesDocument) propSet.toXmlObject();
- }
-
- private EndpointReferenceType getResourceEpr()
- throws ResourceContextException, ResourceException
- {
- PrinterPortResource resource = (PrinterPortResource) getResourceContext().getResource();
- return resource.getEpr();
- }
-
-
- public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Print_Job(org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrintJobRequestDocument requestDoc)
- {
-
- CreationResponseDocument responseDocument = createResponseDocument();
- CreationResponseDocument.CreationResponse creationResponse = responseDocument.getCreationResponse();
- JobPortResource jobResource = null;
- if(isAcceptingJobs())
- {
- try
- {
- Context initialContext = new InitialContext();
- JobPortHome home = (JobPortHome) initialContext.lookup(JobPortHome.HOME_LOCATION);
- PrintJobRequestDocument.PrintJobRequest printJobRequest = requestDoc.getPrintJobRequest();
- String jobName = printJobRequest.getJobName();
+ /**
+ * Creates a new {@link PrinterPortService } object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public PrinterPortService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceContext getResourceContext( )
+ {
+ return m_resourceContext;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Create_Job( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreateJobRequestDocument requestDoc )
+ {
+ CreationResponseDocument responseDocument = createResponseDocument( );
+ CreationResponseDocument.CreationResponse creationResponse = responseDocument.getCreationResponse( );
+ JobPortResource jobResource = null;
+
+ if ( isAcceptingJobs( ) )
+ {
+ try
+ {
+ Context initialContext = new InitialContext( );
+ JobPortHome home =
+ (JobPortHome) initialContext.lookup( JobPortHome.HOME_LOCATION );
+ CreateJobRequestDocument.CreateJobRequest createJobRequest = requestDoc.getCreateJobRequest( );
+ String jobName = createJobRequest.getJobName( );
+ jobResource = (JobPortResource) home.createJob( getResourceContext( ),
+ jobName,
+ getResourceEpr( ) );
+ Calendar currentTime = jobResource.getCurrentTime( );
+ Calendar termTime = Calendar.getInstance( );
+ termTime.set( currentTime.get( Calendar.YEAR ),
+ currentTime.get( Calendar.MONTH ),
+ currentTime.get( Calendar.DATE ),
+ currentTime.get( Calendar.HOUR ),
+ currentTime.get( Calendar.MINUTE ) + 4 );
+ jobResource.setTerminationTime( termTime );
+ addJobPropsToPrinterProps( jobResource );
+ incrementQueueCount( );
+ addJobInfoToResponse( jobResource, creationResponse );
+ }
+ catch ( Exception e )
+ {
+ creationResponse.setSuccessStatusCode( "server-error-internal-error" );
+ }
+ }
+ else
+ {
+ //throw custom client fault
+ }
+
+ return responseDocument;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.CreationResponseDocument Print_Job( org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.PrintJobRequestDocument requestDoc )
+ {
+ CreationResponseDocument responseDocument = createResponseDocument( );
+ CreationResponseDocument.CreationResponse creationResponse = responseDocument.getCreationResponse( );
+ JobPortResource jobResource = null;
+ if ( isAcceptingJobs( ) )
+ {
+ try
+ {
+ Context initialContext = new InitialContext( );
+ JobPortHome home =
+ (JobPortHome) initialContext.lookup( JobPortHome.HOME_LOCATION );
+ PrintJobRequestDocument.PrintJobRequest printJobRequest = requestDoc.getPrintJobRequest( );
+ String jobName = printJobRequest.getJobName( );
//check if valid format type
- MimeMediaTypeType.Enum documentFormat = printJobRequest.getDocumentFormat();
+ MimeMediaTypeType.Enum documentFormat = printJobRequest.getDocumentFormat( );
- if (isDocTypeSupported(documentFormat))
+ if ( isDocTypeSupported( documentFormat ) )
{
- DocumentContentType documentContent = printJobRequest.getDocumentContent();
- byte[] base64Data = documentContent.getBase64Data();
- jobResource = (JobPortResource) home.createJob(getResourceContext(), jobName, "", documentFormat, base64Data, getResourceEpr());
- addJobPropsToPrinterProps(jobResource);
- incrementQueueCount();
- addJobInfoToResponse(jobResource, creationResponse);
+ DocumentContentType documentContent = printJobRequest.getDocumentContent( );
+ byte[] base64Data = documentContent.getBase64Data( );
+ jobResource =
+ (JobPortResource) home.createJob( getResourceContext( ),
+ jobName,
+ "",
+ documentFormat,
+ base64Data,
+ getResourceEpr( ) );
+ addJobPropsToPrinterProps( jobResource );
+ incrementQueueCount( );
+ addJobInfoToResponse( jobResource, creationResponse );
}
else
{
- //throw some exception custom client
- }
- }
- catch (Exception e)
- {
- creationResponse.setSuccessStatusCode("server-error-internal-error");
- }
- }
- else
- {
- //throw custom fault
- }
- return responseDocument;
- }
-
- private void addJobInfoToResponse(JobPortResource instance, CreationResponseDocument.CreationResponse creationResponse)
- {
- org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = instance.getResourcePropertySet();
- creationResponse.setJobReference((EndpointReferenceType) ((XmlBeansResourceProperty) resourcePropertySet.get(JobPortPropertyQNames.JOB_REFERENCE)).toXmlObjects()[0]);
- JobStateType jobState = (JobStateType) ((XmlBeansResourceProperty) resourcePropertySet.get(JobPortPropertyQNames.JOB_STATE)).toXmlObjects()[0];
- creationResponse.xsetJobState(jobState);//only way I could get to compile
- creationResponse.setSuccessStatusCode("successful-ok");
- }
-
- private boolean isAcceptingJobs()
- {
- PrinterPortResource resource = null;
- try
- {
- resource = (PrinterPortResource) getResourceContext().getResource();
- }
- catch (Exception e)
- {
- //todo throw custom exception
- }
-
- XmlBeansResourceProperty resourceProperty = (XmlBeansResourceProperty) resource.getResourcePropertySet().get(PrinterPortPropertyQNames.PRINTER_IS_ACCEPTING_JOBS);
- XmlBoolean doc = (XmlBoolean) resourceProperty.get(0);
- return doc.getBooleanValue();
- }
-
- private boolean isDocTypeSupported(MimeMediaTypeType.Enum documentFormat)
- throws ResourceContextException, ResourceException
- {
- boolean docTypeSupported = false;
- PrinterPortResource resource = (PrinterPortResource) getResourceContext().getResource();
- XmlBeansResourceProperty resourceProperty = (XmlBeansResourceProperty) resource.getResourcePropertySet().get(PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED);
- MimeMediaTypes documentFormatSupported = (MimeMediaTypes) resourceProperty.get(0);
- MimeMediaTypeType.Enum[] mimeMediaTypeArray = documentFormatSupported.getMimeMediaTypeArray();
-
- //todo chekc that the equals check really works
- for (int i = 0; i < mimeMediaTypeArray.length; i++)
- {
- MimeMediaTypeType.Enum enum = mimeMediaTypeArray[i];
- if (enum.equals(documentFormat))
- {
- docTypeSupported = true;
+ //throw some exception custom client
}
- }
- return docTypeSupported;
- }
-
-
- private CreationResponseDocument createResponseDocument()
- {
- CreationResponseDocument creationResponseDocument = CreationResponseDocument.Factory.newInstance();
- creationResponseDocument.addNewCreationResponse();
- return creationResponseDocument;
- }
-
-
-}
+ }
+ catch ( Exception e )
+ {
+ creationResponse.setSuccessStatusCode( "server-error-internal-error" );
+ }
+ }
+ else
+ {
+ //throw custom fault
+ }
+
+ return responseDocument;
+ }
+
+ private boolean isAcceptingJobs( )
+ {
+ PrinterPortResource resource = null;
+ try
+ {
+ resource = (PrinterPortResource) getResourceContext( ).getResource( );
+ }
+ catch ( Exception e )
+ {
+ //todo throw custom exception
+ }
+
+ XmlBeansResourceProperty resourceProperty =
+ (XmlBeansResourceProperty) resource.getResourcePropertySet( ).get( PrinterPortPropertyQNames.PRINTER_IS_ACCEPTING_JOBS );
+ XmlBoolean doc = (XmlBoolean) resourceProperty.get( 0 );
+ return doc.getBooleanValue( );
+ }
+
+ private boolean isDocTypeSupported( MimeMediaTypeType.Enum documentFormat )
+ throws ResourceContextException,
+ ResourceException
+ {
+ boolean docTypeSupported = false;
+ PrinterPortResource resource =
+ (PrinterPortResource) getResourceContext( ).getResource( );
+ XmlBeansResourceProperty resourceProperty =
+ (XmlBeansResourceProperty) resource.getResourcePropertySet( ).get( PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED );
+ MimeMediaTypes documentFormatSupported = (MimeMediaTypes) resourceProperty.get( 0 );
+ MimeMediaTypeType.Enum[] mimeMediaTypeArray = documentFormatSupported.getMimeMediaTypeArray( );
+
+ //todo chekc that the equals check really works
+ for ( int i = 0; i < mimeMediaTypeArray.length; i++ )
+ {
+ MimeMediaTypeType.Enum enum = mimeMediaTypeArray[i];
+ if ( enum.equals( documentFormat ) )
+ {
+ docTypeSupported = true;
+ }
+ }
+
+ return docTypeSupported;
+ }
+
+ private JobPropertiesDocument getJobPropDoc( JobPortResource instance )
+ {
+ XmlBeansResourcePropertySet propSet = (XmlBeansResourcePropertySet) instance.getResourcePropertySet( );
+ return (JobPropertiesDocument) propSet.toXmlObject( );
+ }
+
+ private EndpointReferenceType getResourceEpr( )
+ throws ResourceContextException,
+ ResourceException
+ {
+ PrinterPortResource resource = (PrinterPortResource) getResourceContext( ).getResource( );
+ return resource.getEpr( );
+ }
+
+ private void addJobInfoToResponse( JobPortResource instance,
+ CreationResponseDocument.CreationResponse creationResponse )
+ {
+ org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet =
+ instance.getResourcePropertySet( );
+ creationResponse.setJobReference( (EndpointReferenceType) ( (XmlBeansResourceProperty) resourcePropertySet
+ .get( JobPortPropertyQNames.JOB_REFERENCE ) )
+ .toXmlObjects( )[0] );
+ JobStateType jobState =
+ (JobStateType) ( (XmlBeansResourceProperty) resourcePropertySet.get( JobPortPropertyQNames.JOB_STATE ) )
+ .toXmlObjects( )[0];
+ creationResponse.xsetJobState( jobState ); //only way I could get to compile
+ creationResponse.setSuccessStatusCode( "successful-ok" );
+ }
+
+ private void addJobPropsToPrinterProps( JobPortResource instance )
+ throws ResourceContextException,
+ ResourceException
+ {
+ JobPropertiesDocument jobPropDoc = getJobPropDoc( instance );
+ PrinterPortResource printerResource = (PrinterPortResource) getResourceContext( ).getResource( );
+ ResourceProperty printerJobProperties =
+ printerResource.getResourcePropertySet( ).get( PrinterPortPropertyQNames.JOB_PROPERTIES );
+ printerJobProperties.add( jobPropDoc );
+ }
+
+ private CreationResponseDocument createResponseDocument( )
+ {
+ CreationResponseDocument creationResponseDocument = CreationResponseDocument.Factory.newInstance( );
+ creationResponseDocument.addNewCreationResponse( );
+ return creationResponseDocument;
+ }
+
+ private void incrementQueueCount( )
+ throws ResourceException,
+ ResourceContextException
+ {
+ PrinterPortResource printerResource = (PrinterPortResource) getResourceContext( ).getResource( );
+ ResourceProperty printerJobProperties =
+ printerResource.getResourcePropertySet( ).get( PrinterPortPropertyQNames.QUEUED_JOB_COUNT );
+ XmlInteger queued = (XmlInteger) printerJobProperties.get( 0 );
+ BigInteger bigIntegerValue = queued.getBigIntegerValue( );
+ int count = bigIntegerValue.intValue( );
+ count++;
+ queued.setBigIntegerValue( BigInteger.valueOf( count ) );
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org