├── .gitignore
├── jspi-web
├── src
│ └── main
│ │ ├── webapp
│ │ ├── META-INF
│ │ │ └── MANIFEST.MF
│ │ └── WEB-INF
│ │ │ └── web.xml
│ │ └── java
│ │ └── com
│ │ └── xinterium
│ │ └── jspi
│ │ └── web
│ │ ├── IppServlet.java
│ │ └── IppResponseIppImpl.java
└── pom.xml
├── jspi-core
├── src
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── xinterium
│ │ │ └── jspi
│ │ │ ├── test
│ │ │ ├── test.properties
│ │ │ ├── TestJarLookup.java
│ │ │ ├── attribute
│ │ │ │ └── IppAttributeNameTest.java
│ │ │ ├── IppPrintServiceLookupTest.java
│ │ │ ├── IppRequestTestImplTest.java
│ │ │ └── IppPrintServiceTest.java
│ │ │ └── examples
│ │ │ ├── examples.properties
│ │ │ ├── Messages.java
│ │ │ ├── MultiDocExample.java
│ │ │ └── SimpleDocExample.java
│ └── main
│ │ └── java
│ │ └── de
│ │ └── lohndirekt
│ │ └── print
│ │ ├── exception
│ │ ├── EndOfAttributesException.java
│ │ └── AuthenticationException.java
│ │ ├── attribute
│ │ ├── ipp
│ │ │ ├── jobdesc
│ │ │ │ ├── LdJobStateReason.java
│ │ │ │ ├── TimeAtCreation.java
│ │ │ │ ├── JobMoreInfo.java
│ │ │ │ ├── JobPrinterUpTime.java
│ │ │ │ ├── TimeAtCompleted.java
│ │ │ │ ├── JobPrinterUri.java
│ │ │ │ ├── JobId.java
│ │ │ │ ├── JobUri.java
│ │ │ │ ├── TimeAtProcessing.java
│ │ │ │ └── JobOriginatingHostName.java
│ │ │ ├── printerdesc
│ │ │ │ ├── PrinterUpTime.java
│ │ │ │ ├── defaults
│ │ │ │ │ ├── CopiesDefault.java
│ │ │ │ │ ├── NumberUpDefault.java
│ │ │ │ │ ├── FinishingsDefault.java
│ │ │ │ │ ├── JobPriorityDefault.java
│ │ │ │ │ ├── SidesDefault.java
│ │ │ │ │ ├── OrientationRequestedDefault.java
│ │ │ │ │ ├── CharsetConfigured.java
│ │ │ │ │ ├── JobHoldUntilDefault.java
│ │ │ │ │ ├── DocumentFormatDefault.java
│ │ │ │ │ ├── MediaDefault.java
│ │ │ │ │ ├── JobSheetsDefault.java
│ │ │ │ │ └── MultipleDocumentHandlingDefault.java
│ │ │ │ ├── MultipleOperationTimeout.java
│ │ │ │ ├── supported
│ │ │ │ │ ├── FinishingsSupported.java
│ │ │ │ │ ├── PrinterUriSupported.java
│ │ │ │ │ ├── SidesSupported.java
│ │ │ │ │ ├── CharsetSupported.java
│ │ │ │ │ ├── OrientationRequestedSupported.java
│ │ │ │ │ ├── OutputBinSupported.java
│ │ │ │ │ ├── CompressionSupported.java
│ │ │ │ │ ├── JobHoldUntilSupported.java
│ │ │ │ │ ├── DocumentFormatSupported.java
│ │ │ │ │ ├── MediaSupported.java
│ │ │ │ │ ├── IppVersionsSupported.java
│ │ │ │ │ ├── JobSheetsSupported.java
│ │ │ │ │ ├── GeneratedNaturalLanguageSupported.java
│ │ │ │ │ ├── MultipleDocumentHandlingSupported.java
│ │ │ │ │ ├── UriSecuritySupported.java
│ │ │ │ │ ├── PageRangesSupported.java
│ │ │ │ │ ├── UriAuthenticationSupported.java
│ │ │ │ │ └── MultipleDocumentJobsSupported.java
│ │ │ │ ├── PrinterCurrentTime.java
│ │ │ │ ├── NaturalLanguageConfigured.java
│ │ │ │ ├── PrinterDriverInstaller.java
│ │ │ │ └── PrinterStateMessage.java
│ │ │ ├── StatusMessage.java
│ │ │ ├── DocumentFormat.java
│ │ │ ├── jobtempl
│ │ │ │ ├── LdMediaTray.java
│ │ │ │ └── LdJobHoldUntil.java
│ │ │ ├── DetailedStatusMessage.java
│ │ │ ├── RequestedAttributes.java
│ │ │ ├── UnknownAttribute.java
│ │ │ ├── NaturalLanguage.java
│ │ │ ├── Charset.java
│ │ │ └── LastDocument.java
│ │ ├── DefaultAttribute.java
│ │ ├── cups
│ │ │ ├── DeviceUri.java
│ │ │ ├── MemberUris.java
│ │ │ ├── MemberNames.java
│ │ │ ├── JobKLimit.java
│ │ │ ├── JobPageLimit.java
│ │ │ ├── JobQuotaPeriod.java
│ │ │ ├── DeviceClass.java
│ │ │ └── PrinterType.java
│ │ ├── undocumented
│ │ │ └── PrinterStateTime.java
│ │ ├── auth
│ │ │ └── RequestingUserPassword.java
│ │ ├── IppDelimiterTag.java
│ │ └── IppValueTag.java
│ │ ├── MultiDocListener.java
│ │ ├── MediaMultiDocJob.java
│ │ ├── MultiDocEvent.java
│ │ ├── IppResponse.java
│ │ ├── IppRequest.java
│ │ ├── IppConnection.java
│ │ ├── IppMultiDocPrintService.java
│ │ ├── MediaMultiDoc.java
│ │ ├── Messages.java
│ │ ├── CancelableJob.java
│ │ ├── IppRequestFactory.java
│ │ ├── IppServer.java
│ │ ├── SimpleMultiDoc.java
│ │ └── IppHttpConnection.java
└── pom.xml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | target
3 | *.iml
4 |
--------------------------------------------------------------------------------
/jspi-web/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/test/test.properties:
--------------------------------------------------------------------------------
1 | cups.uri=http://192.168.0.58:631
2 | cups.username=horst
3 | cups.password=test
4 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/examples/examples.properties:
--------------------------------------------------------------------------------
1 | #cups.uri=http://192.168.0.58:631
2 | #cups.uri=http://127.0.0.1:631
3 | cups.uri=http://127.0.0.1:9090/ipp/IppServlet
4 | cups.username=root
5 | cups.password=test
6 | pdfdocument.1=./testfiles/test.pdf
7 | pdfdocument.2=./testfiles/test.pdf
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/exception/EndOfAttributesException.java:
--------------------------------------------------------------------------------
1 | package de.lohndirekt.print.exception;
2 |
3 | /**
4 | *
5 | * Exception used to signal that the EndAttributes tag has been
6 | * reached while parsing an IppResponse
7 | *
8 | * @author bpusch
9 | *
10 | */
11 | public class EndOfAttributesException extends Exception {
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | /* (Kein Javadoc)
20 | * @see java.lang.Throwable#fillInStackTrace()
21 | */
22 | public synchronized Throwable fillInStackTrace() {
23 | return this;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/LdJobStateReason.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Created on 22.01.2004
3 | *
4 | *
5 | */
6 | package de.lohndirekt.print.attribute.ipp.jobdesc;
7 |
8 | import java.util.Locale;
9 |
10 | import javax.print.attribute.standard.JobStateReason;
11 |
12 | /**
13 | * @author bpusch
14 | *
15 | *
16 | */
17 | public class LdJobStateReason extends JobStateReason {
18 |
19 | private String stringValue;
20 |
21 | public static LdJobStateReason NONE = new LdJobStateReason("none", Locale.getDefault(), -1);
22 |
23 | /**
24 | * @param value
25 | */
26 | private LdJobStateReason(String stringValue, Locale locale, int value) {
27 | super(value);
28 | this.stringValue = stringValue;
29 | }
30 |
31 | public String toString(){
32 | if (this.stringValue != null){
33 | return this.stringValue;
34 | } else {
35 | return super.toString();
36 | }
37 | }
38 |
39 |
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/jspi-web/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | jspi
4 |
5 | index.html
6 | index.htm
7 | index.jsp
8 | default.html
9 | default.htm
10 | default.jsp
11 |
12 |
13 |
14 | IppServlet
15 | IppServlet
16 | com.xinterium.jspi.web.IppServlet
17 |
18 |
19 | IppServlet
20 | /IppServlet
21 |
22 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/DefaultAttribute.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute;
20 |
21 | import javax.print.attribute.Attribute;
22 |
23 |
24 | public interface DefaultAttribute extends Attribute{
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/exception/AuthenticationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Created on 10.09.2004
3 | *
4 | *
5 | */
6 | package de.lohndirekt.print.exception;
7 |
8 | /**
9 | * @author sefftinge
10 | *
11 | *
12 | */
13 | public class AuthenticationException extends RuntimeException {
14 |
15 | /**
16 | *
17 | */
18 | public AuthenticationException() {
19 | super();
20 | // TODO Auto-generated constructor stub
21 | }
22 |
23 | /**
24 | * @param message
25 | */
26 | public AuthenticationException(String message) {
27 | super(message);
28 | // TODO Auto-generated constructor stub
29 | }
30 |
31 | /**
32 | * @param message
33 | * @param cause
34 | */
35 | public AuthenticationException(String message, Throwable cause) {
36 | super(message, cause);
37 | // TODO Auto-generated constructor stub
38 | }
39 |
40 | /**
41 | * @param cause
42 | */
43 | public AuthenticationException(Throwable cause) {
44 | super(cause);
45 | // TODO Auto-generated constructor stub
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/MultiDocListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 |
20 | package de.lohndirekt.print;
21 |
22 | import java.io.IOException;
23 |
24 |
25 |
26 | /**
27 | * @author bpusch
28 | *
29 | */
30 | interface MultiDocListener {
31 |
32 |
33 | void processEvent(MultiDocEvent event) throws IOException;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/MediaMultiDocJob.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | /**
22 | * @author bpusch
23 | *
24 | */
25 | class MediaMultiDocJob extends MultiDocJob {
26 |
27 | /**
28 | * @param service
29 | */
30 | public MediaMultiDocJob(IppMultiDocPrintService service) {
31 | super(service);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/MultiDocEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 |
20 | package de.lohndirekt.print;
21 |
22 | import javax.print.MultiDoc;
23 | import javax.print.event.PrintEvent;
24 |
25 | /**
26 | * @author bpusch
27 | *
28 | */
29 | class MultiDocEvent extends PrintEvent {
30 |
31 | /**
32 | *
33 | */
34 | public MultiDocEvent(MultiDoc source) {
35 | super(source);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/jspi-web/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.xinterium.jspi
6 | jspi-web
7 | 1.0-SNAPSHOT
8 | war
9 |
10 | jspi-web
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 |
16 |
17 |
18 |
19 |
20 | com.xinterium.jspi
21 | jspi-core
22 | 1.0-SNAPSHOT
23 |
24 |
25 | javax.servlet
26 | servlet-api
27 | 2.5
28 | provided
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | org.apache.tomcat.maven
37 | tomcat7-maven-plugin
38 | 2.2
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppResponse.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.util.Map;
22 |
23 | import de.lohndirekt.print.attribute.IppStatus;
24 |
25 | /**
26 | * @author sefftinge
27 | *
28 | */
29 | public interface IppResponse {
30 | /**
31 | * @return attributes
32 | */
33 | Map getAttributes();
34 | /**
35 | * @return the IppStatus
36 | */
37 | IppStatus getStatus();
38 | }
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppRequest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 |
24 | import javax.print.attribute.AttributeSet;
25 | import javax.print.attribute.PrintJobAttributeSet;
26 |
27 | /**
28 | * @author sefftinge
29 | *
30 | */
31 | public interface IppRequest {
32 |
33 | IppResponse send() throws IOException;
34 | void setData(byte[] data);
35 | void setData(InputStream data);
36 | void setJobAttributes(PrintJobAttributeSet attributes);
37 | void addOperationAttributes(AttributeSet attributes);
38 | void setPrinterAttributes(AttributeSet attributes);
39 | }
--------------------------------------------------------------------------------
/jspi-core/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.xinterium.jspi
6 | jspi-core
7 | 1.0-SNAPSHOT
8 | jar
9 |
10 | jspi-core
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 | 1.7
16 | 1.7
17 |
18 |
19 |
20 |
21 | junit
22 | junit
23 | 4.11
24 | test
25 |
26 |
27 |
28 | commons-httpclient
29 | commons-httpclient
30 | 3.1
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | org.apache.maven.plugins
39 | maven-source-plugin
40 | 2.2.1
41 |
42 |
43 | attach-sources
44 |
45 | jar
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppConnection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 |
24 | /**
25 | *
26 | * @author sefftinge
27 | *
28 | */
29 | interface IppConnection {
30 | /**
31 | * @return content of the response
32 | * @throws IOException
33 | */
34 | InputStream getIppResponse() throws IOException;
35 |
36 | /**
37 | * @return the statuscode of last request
38 | * @throws IOException
39 | */
40 | int getStatusCode() throws IOException;
41 |
42 | /**
43 | * @param stream
44 | */
45 | void setIppRequest(InputStream stream);
46 |
47 | boolean execute() throws IOException;
48 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## JSPI - Java Internet Printing Protocol Implementation
2 |
3 | This library enables you to add remote printing capabilities to your Java applications running on servers and other client applications.
4 |
5 |
6 | ### Usage
7 |
8 | #### Adding dependency using Apache Maven
9 |
10 | 1. Clone the project
11 |
12 | Execute `git clone https://github.com/bhagyas/jspi`
13 |
14 | 2. Install artifact on your Maven repository
15 |
16 | Change into `jspi-core` project and execute `mvn clean install` or `mvn deploy`. Note that you might need to skip the tests when building the project.
17 |
18 | 3. Add as a dependency
19 |
20 | Add the following on your `pom.xml`
21 |
22 | ```
23 |
24 | com.xinterium.jspi
25 | jspi-core
26 | 1.0-SNAPSHOT
27 |
28 | ```
29 |
30 |
31 | ### API and Examples
32 |
33 | Examples are available in the `jspi-core/src/test` directory along with the tests.
34 |
35 | #### Notes from the History :
36 |
37 | ##### jspi
38 | This project is based on the original project exported from code.google.com/p/jspi (LGPL)
39 |
40 | ##### Description:
41 |
42 | We realize a pure java implementation of the internet printing protocol (ipp) implementing Java Print Service API (jsp). This implementation can be useful for both server and client side code, so this helps in high level printing services, virtual printers for document conversion and so on.
43 |
44 | ### Authors
45 | - Bhagya Silva ([https://about.me/bhagyas](https://about.me/bhagyas))
46 |
47 | Original library author information can be found on the Google Code project location.
48 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/DeviceUri.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.Attribute;
24 | import javax.print.attribute.URISyntax;
25 |
26 |
27 | public class DeviceUri extends URISyntax implements Attribute {
28 |
29 | /**
30 | * @param uri
31 | */
32 | public DeviceUri(URI uri) {
33 | super(uri);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return DeviceUri.getIppName();
50 | }
51 |
52 | public static String getIppName(){
53 | return "device-uri";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/MemberUris.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.Attribute;
24 | import javax.print.attribute.URISyntax;
25 |
26 |
27 | public class MemberUris extends URISyntax implements Attribute {
28 |
29 | /**
30 | * @param uri
31 | */
32 | public MemberUris(URI uri) {
33 | super(uri);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return MemberUris.getIppName();
50 | }
51 |
52 | public static String getIppName(){
53 | return "member-uris";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppMultiDocPrintService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.MultiDocPrintJob;
24 | import javax.print.MultiDocPrintService;
25 | /**
26 | * @author bpusch
27 | *
28 | *
29 | */
30 | class IppMultiDocPrintService extends IppPrintService implements MultiDocPrintService {
31 |
32 |
33 | /**
34 | * @param uri
35 | */
36 | public IppMultiDocPrintService(URI uri){
37 | super(uri);
38 | }
39 |
40 | /* (non-Javadoc)
41 | * @see javax.print.MultiDocPrintService#createMultiDocPrintJob()
42 | */
43 | public MultiDocPrintJob createMultiDocPrintJob() {
44 | return new MediaMultiDocJob(this);
45 | }
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/MediaMultiDoc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import javax.print.Doc;
22 | import javax.print.attribute.standard.Media;
23 |
24 |
25 |
26 | /**
27 | * @author bpusch
28 | *
29 | */
30 | class MediaMultiDoc extends SimpleMultiDoc {
31 |
32 | Media media = null;
33 |
34 | public static MediaMultiDoc create(Doc doc, Media media) {
35 |
36 | return new MediaMultiDoc(doc, media, false);
37 | }
38 |
39 | public static SimpleMultiDoc create(Doc doc, Media media, boolean lastDoc) {
40 | return new MediaMultiDoc(doc, media, lastDoc);
41 | }
42 |
43 | /**
44 | *
45 | */
46 | private MediaMultiDoc(Doc doc, Media media, boolean lastDoc) {
47 | super(doc,lastDoc);
48 | this.media = media;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/TimeAtCreation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintJobAttribute;
23 |
24 |
25 | public class TimeAtCreation extends IntegerSyntax implements PrintJobAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public TimeAtCreation(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public String getName() {
43 | return TimeAtCreation.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "time-at-creation";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/JobMoreInfo.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.PrintJobAttribute;
24 | import javax.print.attribute.URISyntax;
25 |
26 |
27 | public class JobMoreInfo extends URISyntax implements PrintJobAttribute {
28 |
29 | /**
30 | * @param uri
31 | */
32 | public JobMoreInfo(URI uri) {
33 | super(uri);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return JobMoreInfo.getIppName();
50 | }
51 |
52 | public static String getIppName(){
53 | return "job-more-info";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/JobPrinterUpTime.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintJobAttribute;
23 |
24 |
25 | public class JobPrinterUpTime extends IntegerSyntax implements PrintJobAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public JobPrinterUpTime(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public String getName() {
43 | return JobPrinterUpTime.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "job-printer-up-time";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/PrinterUpTime.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 |
25 | public class PrinterUpTime extends IntegerSyntax implements PrintServiceAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public PrinterUpTime(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public String getName() {
43 | return PrinterUpTime.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "printer-up-time";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/TimeAtCompleted.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 |
22 | import javax.print.attribute.IntegerSyntax;
23 | import javax.print.attribute.PrintJobAttribute;
24 |
25 |
26 | public class TimeAtCompleted extends IntegerSyntax implements PrintJobAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public TimeAtCompleted(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public String getName() {
44 | return TimeAtCompleted.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 | public static String getIppName() {
51 | return "time-at-completed";
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/JobPrinterUri.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.PrintJobAttribute;
24 | import javax.print.attribute.URISyntax;
25 |
26 |
27 | public class JobPrinterUri extends URISyntax implements PrintJobAttribute {
28 |
29 | /**
30 | * @param uri
31 | */
32 | public JobPrinterUri(URI uri) {
33 | super(uri);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return JobPrinterUri.getIppName();
50 | }
51 |
52 | public static String getIppName(){
53 | return "job-printer-uri";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/undocumented/PrinterStateTime.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.undocumented;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 |
25 | public class PrinterStateTime extends IntegerSyntax implements PrintServiceAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public PrinterStateTime(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public String getName() {
43 | return PrinterStateTime.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "printer-state-time";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/StatusMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.Attribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class StatusMessage extends TextSyntax implements Attribute{
27 |
28 |
29 | /**
30 | * @param value
31 | */
32 | public StatusMessage(String name, Locale locale) {
33 | super(name, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return StatusMessage.class;
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public static String getIppName() {
49 | return "status-message";
50 | }
51 |
52 | public String getName() {
53 | return StatusMessage.getIppName();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/JobId.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintJobAttribute;
23 | import javax.print.attribute.PrintRequestAttribute;
24 |
25 |
26 | public class JobId extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public JobId(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 | public String getName() {
43 | return JobId.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "job-id";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/DocumentFormat.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.DocAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class DocumentFormat extends TextSyntax implements DocAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public DocumentFormat(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return DocumentFormat.class;
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public static String getIppName() {
48 | return "document-format";
49 | }
50 |
51 | public String getName() {
52 | return DocumentFormat.getIppName();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobtempl/LdMediaTray.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobtempl;
20 |
21 | import javax.print.attribute.PrintJobAttribute;
22 | import javax.print.attribute.PrintRequestAttribute;
23 | import javax.print.attribute.standard.Media;
24 |
25 | public class LdMediaTray extends Media implements PrintRequestAttribute, PrintJobAttribute {
26 |
27 | private String name;
28 |
29 | /**
30 | * @param trayName
31 | * @throws NullPointerException if trayName is null
32 | */
33 | public LdMediaTray(String trayName) {
34 | super(0);
35 | if (trayName == null) {
36 | throw new NullPointerException("TrayName must not be null");
37 | }
38 | this.name = trayName;
39 | }
40 |
41 | public String toString() {
42 | return this.name;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/CopiesDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 |
23 | import de.lohndirekt.print.attribute.DefaultAttribute;
24 |
25 |
26 | public class CopiesDefault extends IntegerSyntax implements DefaultAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public CopiesDefault(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public String getName() {
44 | return CopiesDefault.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 | public static String getIppName() {
51 | return "copies-default";
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/NumberUpDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 |
23 | import de.lohndirekt.print.attribute.DefaultAttribute;
24 |
25 |
26 | public class NumberUpDefault extends IntegerSyntax implements DefaultAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public NumberUpDefault(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public String getName() {
44 | return NumberUpDefault.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 | public static String getIppName() {
51 | return "number-up-default";
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/JobUri.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.PrintJobAttribute;
24 | import javax.print.attribute.PrintRequestAttribute;
25 | import javax.print.attribute.URISyntax;
26 |
27 |
28 | public class JobUri extends URISyntax implements PrintRequestAttribute, PrintJobAttribute {
29 |
30 | /**
31 | * @param uri
32 | */
33 | public JobUri(URI uri) {
34 | super(uri);
35 | }
36 |
37 | /**
38 | *
39 | */
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 | public String getName() {
48 | return JobUri.getIppName();
49 | }
50 |
51 | public static String getIppName(){
52 | return "job-uri";
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/FinishingsDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 |
23 | import de.lohndirekt.print.attribute.DefaultAttribute;
24 |
25 |
26 | public class FinishingsDefault extends IntegerSyntax implements DefaultAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public FinishingsDefault(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public String getName() {
44 | return FinishingsDefault.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 | public static String getIppName() {
51 | return "finishings-default";
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/MultipleOperationTimeout.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 |
25 | public class MultipleOperationTimeout extends IntegerSyntax implements PrintServiceAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public MultipleOperationTimeout(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 | public String getName() {
42 | return MultipleOperationTimeout.getIppName();
43 | }
44 |
45 | /**
46 | *
47 | */
48 | public static String getIppName() {
49 | return "multiple-operation-time-out";
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/JobPriorityDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 |
23 | import de.lohndirekt.print.attribute.DefaultAttribute;
24 |
25 |
26 | public class JobPriorityDefault extends IntegerSyntax implements DefaultAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public JobPriorityDefault(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public String getName() {
44 | return JobPriorityDefault.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 | public static String getIppName() {
51 | return "job-priority-default";
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/FinishingsSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.SupportedValuesAttribute;
23 |
24 |
25 | public class FinishingsSupported extends IntegerSyntax implements SupportedValuesAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public FinishingsSupported(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public String getName() {
43 | return FinishingsSupported.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "finishings-supported";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/DetailedStatusMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.Attribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class DetailedStatusMessage extends TextSyntax implements Attribute{
27 |
28 |
29 | /**
30 | * @param value
31 | */
32 | public DetailedStatusMessage(String name, Locale locale) {
33 | super(name, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return DetailedStatusMessage.class;
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public static String getIppName() {
49 | return "detailed-status-message";
50 | }
51 |
52 | public String getName() {
53 | return DetailedStatusMessage.getIppName();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/RequestedAttributes.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintRequestAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class RequestedAttributes extends TextSyntax implements PrintRequestAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public RequestedAttributes(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return RequestedAttributes.class;
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public static String getIppName() {
48 | return "requested-attributes";
49 | }
50 |
51 | public String getName() {
52 | return RequestedAttributes.getIppName();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/MemberNames.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.Attribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 |
27 | public class MemberNames extends TextSyntax implements Attribute {
28 |
29 |
30 | /**
31 | * @param value
32 | * @param locale
33 | */
34 | public MemberNames(String value, Locale locale) {
35 | super(value, locale);
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public Class getCategory() {
43 | return this.getClass();
44 | }
45 |
46 | /**
47 | *
48 | */
49 |
50 | public String getName() {
51 | return MemberNames.getIppName();
52 | }
53 |
54 | /**
55 | *
56 | */
57 | public static String getIppName() {
58 | return "member-names";
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/SidesDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 | public class SidesDefault extends TextSyntax implements DefaultAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public SidesDefault(String name, Locale locale) {
33 | super(name, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return SidesDefault.class;
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public static String getIppName() {
49 | return "sides-default";
50 | }
51 |
52 | public String getName() {
53 | return SidesDefault.getIppName();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/TimeAtProcessing.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintJobAttribute;
23 |
24 |
25 | public class TimeAtProcessing extends IntegerSyntax implements PrintJobAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public TimeAtProcessing(int value) {
31 | super(value);
32 | }
33 |
34 | public TimeAtProcessing() {
35 | super(-1);
36 | }
37 |
38 |
39 | public Class getCategory() {
40 | return this.getClass();
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public String getName() {
48 | return TimeAtProcessing.getIppName();
49 | }
50 |
51 | /**
52 | *
53 | */
54 | public static String getIppName() {
55 | return "time-at-processing";
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/PrinterUriSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.URISyntax;
25 |
26 |
27 | public class PrinterUriSupported extends URISyntax implements SupportedValuesAttribute {
28 |
29 | /**
30 | * @param uri
31 | */
32 | public PrinterUriSupported(URI uri) {
33 | super(uri);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return PrinterUriSupported.getIppName();
50 | }
51 |
52 | public static String getIppName(){
53 | return "printer-uri-supported";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/SidesSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class SidesSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public SidesSupported(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return SidesSupported.class;
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public static String getIppName() {
48 | return "sides-supported";
49 | }
50 |
51 | public String getName() {
52 | return SidesSupported.getIppName();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/Messages.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.util.MissingResourceException;
22 | import java.util.ResourceBundle;
23 |
24 | /**
25 | * @author ld-development
26 | *
27 | *
28 | */
29 | public class Messages {
30 |
31 | private static final String BUNDLE_NAME = "de.lohndirekt.print.test"; //$NON-NLS-1$
32 |
33 | private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
34 |
35 | /**
36 | *
37 | */
38 | private Messages() {
39 |
40 | }
41 | /**
42 | * @param key
43 | * @return
44 | */
45 | public static String getString(String key) {
46 | try {
47 | return RESOURCE_BUNDLE.getString(key);
48 | } catch (MissingResourceException e) {
49 | return '!' + key + '!';
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/OrientationRequestedDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 |
23 | import de.lohndirekt.print.attribute.DefaultAttribute;
24 |
25 |
26 | public class OrientationRequestedDefault extends IntegerSyntax implements DefaultAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public OrientationRequestedDefault(int value) {
32 | super(value);
33 | }
34 |
35 | public Class getCategory() {
36 | return this.getClass();
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public String getName() {
44 | return OrientationRequestedDefault.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 | public static String getIppName() {
51 | return "orientation-requested-default";
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/auth/RequestingUserPassword.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.auth;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintRequestAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class RequestingUserPassword extends TextSyntax implements PrintRequestAttribute{
27 |
28 |
29 | /**
30 | * @param value
31 | */
32 | public RequestingUserPassword(String name, Locale locale) {
33 | super(name, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return RequestingUserPassword.class;
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public static String getIppName() {
49 | return "requesting-user-password";
50 | }
51 |
52 | public String getName() {
53 | return RequestingUserPassword.getIppName();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobdesc/JobOriginatingHostName.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobdesc;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintJobAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class JobOriginatingHostName extends TextSyntax implements PrintJobAttribute{
27 |
28 | /**
29 | * @param value
30 | */
31 | public JobOriginatingHostName(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return JobOriginatingHostName.class;
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public static String getIppName() {
48 | return "job-originating-host-name";
49 | }
50 |
51 | public String getName() {
52 | return JobOriginatingHostName.getIppName();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/CharsetConfigured.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 | public class CharsetConfigured extends TextSyntax implements DefaultAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public CharsetConfigured(String name, Locale locale) {
33 | super(name, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return CharsetConfigured.class;
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public static String getIppName() {
49 | return "charset-configured";
50 | }
51 |
52 | public String getName() {
53 | return CharsetConfigured.getIppName();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/CharsetSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class CharsetSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public CharsetSupported(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return CharsetSupported.class;
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public static String getIppName() {
48 | return "charset-supported";
49 | }
50 |
51 | public String getName() {
52 | return CharsetSupported.getIppName();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/PrinterCurrentTime.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc;
20 |
21 | import java.util.Date;
22 |
23 | import javax.print.attribute.DateTimeSyntax;
24 | import javax.print.attribute.PrintServiceAttribute;
25 |
26 |
27 | public class PrinterCurrentTime extends DateTimeSyntax implements PrintServiceAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public PrinterCurrentTime(Date value) {
33 | super(value);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return PrinterCurrentTime.getIppName();
50 | }
51 |
52 | /**
53 | * @return
54 | */
55 | public static String getIppName() {
56 | return "printer-current-time";
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/OrientationRequestedSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.SupportedValuesAttribute;
23 |
24 |
25 | public class OrientationRequestedSupported extends IntegerSyntax implements SupportedValuesAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public OrientationRequestedSupported(int value) {
31 | super(value);
32 | }
33 |
34 | public Class getCategory() {
35 | return this.getClass();
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public String getName() {
43 | return OrientationRequestedSupported.getIppName();
44 | }
45 |
46 | /**
47 | *
48 | */
49 | public static String getIppName() {
50 | return "orientation-requested-supported";
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/NaturalLanguageConfigured.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintServiceAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class NaturalLanguageConfigured extends TextSyntax implements PrintServiceAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public NaturalLanguageConfigured(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 | public Class getCategory() {
39 | return NaturalLanguageConfigured.class;
40 | }
41 |
42 | /**
43 | *
44 | */
45 | public static String getIppName() {
46 | return "natural-language-configured";
47 | }
48 |
49 | public String getName() {
50 | return NaturalLanguageConfigured.getIppName();
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/OutputBinSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class OutputBinSupported extends TextSyntax implements
27 | SupportedValuesAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public OutputBinSupported(String name, Locale locale) {
33 | super(name, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return OutputBinSupported.class;
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public static String getIppName() {
49 | return "output-bin-supported";
50 | }
51 |
52 | public String getName() {
53 | return OutputBinSupported.getIppName();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/examples/Messages.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.examples;
20 |
21 | import java.util.MissingResourceException;
22 | import java.util.ResourceBundle;
23 |
24 | /**
25 | * @author ld-development
26 | *
27 | *
28 | */
29 | public class Messages {
30 |
31 | private static final String BUNDLE_NAME = "de.lohndirekt.print.examples.examples"; //$NON-NLS-1$
32 |
33 | private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
34 |
35 | /**
36 | *
37 | */
38 | private Messages() {
39 |
40 | }
41 | /**
42 | * @param key
43 | * @return
44 | */
45 | public static String getString(String key) {
46 | try {
47 | return RESOURCE_BUNDLE.getString(key);
48 | } catch (MissingResourceException e) {
49 | return '!' + key + '!';
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/JobHoldUntilDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 | public class JobHoldUntilDefault extends TextSyntax implements DefaultAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public JobHoldUntilDefault(String value, Locale locale) {
33 | super(value, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return JobHoldUntilDefault.class;
42 | }
43 |
44 | public String getName() {
45 | return JobHoldUntilDefault.getIppName();
46 | }
47 |
48 | /**
49 | *
50 | */
51 |
52 | public final static String getIppName() {
53 | return "job-hold-until-default";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/DocumentFormatDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 | public class DocumentFormatDefault extends TextSyntax implements DefaultAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public DocumentFormatDefault(String value, Locale locale) {
33 | super(value, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return DocumentFormatDefault.class;
42 | }
43 |
44 | public String getName() {
45 | return DocumentFormatDefault.getIppName();
46 | }
47 |
48 | /**
49 | *
50 | */
51 |
52 | public final static String getIppName() {
53 | return "document-format-default";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/MediaDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 |
28 | public class MediaDefault extends TextSyntax implements DefaultAttribute {
29 |
30 | /**
31 | * @param value
32 | * @param locale
33 | */
34 | public MediaDefault(String value, Locale locale) {
35 | super(value, locale);
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public Class getCategory() {
43 | return this.getClass();
44 | }
45 |
46 | /**
47 | *
48 | */
49 |
50 | public String getName() {
51 | return MediaDefault.getIppName();
52 | }
53 |
54 | /**
55 | *
56 | */
57 | public static String getIppName() {
58 | return "media-default";
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/CompressionSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class CompressionSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 |
29 | /**
30 | * @param value
31 | */
32 | public CompressionSupported(String value, Locale locale) {
33 | super(value, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return CompressionSupported.class;
42 | }
43 |
44 | public String getName() {
45 | return CompressionSupported.getIppName();
46 | }
47 |
48 | /**
49 | *
50 | */
51 |
52 | public final static String getIppName() {
53 | return "compression-supported";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/JobHoldUntilSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class JobHoldUntilSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public JobHoldUntilSupported(String value, Locale locale) {
32 | super(value, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return JobHoldUntilSupported.class;
41 | }
42 |
43 | public String getName() {
44 | return JobHoldUntilSupported.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 |
51 | public final static String getIppName() {
52 | return "job-hold-until-supported";
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/PrinterDriverInstaller.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc;
20 |
21 | import java.net.URI;
22 |
23 | import javax.print.attribute.PrintServiceAttribute;
24 | import javax.print.attribute.URISyntax;
25 |
26 | public final class PrinterDriverInstaller extends URISyntax implements PrintServiceAttribute {
27 |
28 | public PrinterDriverInstaller(URI uri) {
29 | super(uri);
30 | }
31 |
32 | public boolean equals(Object object) {
33 | return (super.equals(object) && object instanceof PrinterDriverInstaller);
34 | }
35 |
36 | public final Class getCategory() {
37 | return PrinterDriverInstaller.class;
38 | }
39 |
40 | public final String getName() {
41 | return PrinterDriverInstaller.getIppName();
42 | }
43 |
44 | /**
45 | *
46 | */
47 | public static String getIppName() {
48 | return "printer-driver-installer";
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/DocumentFormatSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class DocumentFormatSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public DocumentFormatSupported(String value, Locale locale) {
32 | super(value, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return DocumentFormatSupported.class;
41 | }
42 |
43 | public String getName() {
44 | return DocumentFormatSupported.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 |
51 | public final static String getIppName() {
52 | return "document-format-supported";
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/MediaSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 |
27 | public class MediaSupported extends TextSyntax implements SupportedValuesAttribute {
28 |
29 | /**
30 | * @param value
31 | * @param locale
32 | */
33 | public MediaSupported(String value, Locale locale) {
34 | super(value, locale);
35 | }
36 |
37 | /**
38 | *
39 | */
40 |
41 | public Class getCategory() {
42 | return this.getClass();
43 | }
44 |
45 | /**
46 | *
47 | */
48 |
49 | public String getName() {
50 | return MediaSupported.getIppName();
51 | }
52 |
53 | /**
54 | *
55 | */
56 | public static String getIppName() {
57 | return "media-supported";
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/JobKLimit.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 |
25 | public class JobKLimit extends IntegerSyntax implements PrintServiceAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public JobKLimit(int value) {
31 | super(value);
32 | }
33 |
34 | /**
35 | * @param value
36 | * @param lowerBound
37 | * @param upperBound
38 | */
39 | public JobKLimit(int value, int lowerBound, int upperBound) {
40 | super(value, lowerBound, upperBound);
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public Class getCategory() {
48 | return this.getClass();
49 | }
50 |
51 | public String getName() {
52 | return JobKLimit.getIppName();
53 | }
54 |
55 | public static String getIppName(){
56 | return "job-k-limit";
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/JobSheetsDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 |
28 | public class JobSheetsDefault extends TextSyntax implements DefaultAttribute {
29 |
30 | /**
31 | * @param value
32 | * @param locale
33 | */
34 | public JobSheetsDefault(String value, Locale locale) {
35 | super(value, locale);
36 | }
37 |
38 | /**
39 | *
40 | */
41 |
42 | public Class getCategory() {
43 | return this.getClass();
44 | }
45 |
46 | /**
47 | *
48 | */
49 |
50 | public String getName() {
51 | return JobSheetsDefault.getIppName();
52 | }
53 |
54 | /**
55 | *
56 | */
57 | public static String getIppName() {
58 | return "job-sheets-default";
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/JobPageLimit.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 |
25 | public class JobPageLimit extends IntegerSyntax implements PrintServiceAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public JobPageLimit(int value) {
31 | super(value);
32 | }
33 |
34 | /**
35 | * @param value
36 | * @param lowerBound
37 | * @param upperBound
38 | */
39 | public JobPageLimit(int value, int lowerBound, int upperBound) {
40 | super(value, lowerBound, upperBound);
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public Class getCategory() {
48 | return this.getClass();
49 | }
50 |
51 | public String getName() {
52 | return JobPageLimit.getIppName();
53 | }
54 |
55 | public static String getIppName(){
56 | return "job-page-limit";
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/UnknownAttribute.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class UnknownAttribute extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public UnknownAttribute(String value, Locale locale) {
32 | super(value, locale);
33 | }
34 |
35 | public UnknownAttribute(int number) {
36 | super(Integer.toString(number), Locale.getDefault());
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public Class getCategory() {
44 | return UnknownAttribute.class;
45 | }
46 |
47 | /**
48 | *
49 | */
50 |
51 | public static String getIppName() {
52 | return "unknown-attribute";
53 | }
54 |
55 | public String getName() {
56 | return getIppName();
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/PrinterStateMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintServiceAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 |
27 | public class PrinterStateMessage extends TextSyntax implements PrintServiceAttribute {
28 |
29 |
30 |
31 | /**
32 | * @param value
33 | * @param locale
34 | */
35 | public PrinterStateMessage(String value, Locale locale) {
36 | super(value, locale);
37 | }
38 |
39 | /**
40 | *
41 | */
42 |
43 | public Class getCategory() {
44 | return this.getClass();
45 | }
46 |
47 | /**
48 | *
49 | */
50 |
51 | public String getName() {
52 | return PrinterStateMessage.getIppName();
53 | }
54 |
55 | /**
56 | *
57 | */
58 | public static String getIppName() {
59 | return "printer-state-message";
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/IppVersionsSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class IppVersionsSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | * @param locale
31 | */
32 | public IppVersionsSupported(String value, Locale locale) {
33 | super(value, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return this.getClass();
42 | }
43 |
44 | /**
45 | *
46 | */
47 |
48 | public String getName() {
49 | return IppVersionsSupported.getIppName();
50 | }
51 |
52 | /**
53 | *
54 | */
55 | public static String getIppName() {
56 | return "ipp-versions-supported";
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/JobSheetsSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 |
27 | public class JobSheetsSupported extends TextSyntax implements SupportedValuesAttribute {
28 |
29 | /**
30 | * @param value
31 | * @param locale
32 | */
33 | public JobSheetsSupported(String value, Locale locale) {
34 | super(value, locale);
35 | }
36 |
37 | /**
38 | *
39 | */
40 |
41 | public Class getCategory() {
42 | return this.getClass();
43 | }
44 |
45 | /**
46 | *
47 | */
48 |
49 | public String getName() {
50 | return JobSheetsSupported.getIppName();
51 | }
52 |
53 | /**
54 | *
55 | */
56 | public static String getIppName() {
57 | return "job-sheets-supported";
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/defaults/MultipleDocumentHandlingDefault.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.defaults;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.TextSyntax;
24 |
25 | import de.lohndirekt.print.attribute.DefaultAttribute;
26 |
27 | public class MultipleDocumentHandlingDefault extends TextSyntax implements DefaultAttribute {
28 |
29 | /**
30 | * @param value
31 | */
32 | public MultipleDocumentHandlingDefault(String value, Locale locale) {
33 | super(value, locale);
34 | }
35 |
36 | /**
37 | *
38 | */
39 |
40 | public Class getCategory() {
41 | return MultipleDocumentHandlingDefault.class;
42 | }
43 |
44 | public String getName() {
45 | return MultipleDocumentHandlingDefault.getIppName();
46 | }
47 |
48 | /**
49 | *
50 | */
51 |
52 | public final static String getIppName() {
53 | return "multiple-document-handling-default";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/GeneratedNaturalLanguageSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class GeneratedNaturalLanguageSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public GeneratedNaturalLanguageSupported(String name, Locale locale) {
32 | super(name, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return GeneratedNaturalLanguageSupported.class;
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public static String getIppName() {
48 | return "generated-natural-language-supported";
49 | }
50 |
51 | public String getName() {
52 | return GeneratedNaturalLanguageSupported.getIppName();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/test/TestJarLookup.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.test;
20 |
21 | import java.net.URI;
22 | import java.net.URISyntaxException;
23 |
24 | import javax.print.PrintService;
25 |
26 | import de.lohndirekt.print.IppPrintServiceLookup;
27 |
28 | /**
29 | * @author sefftinge
30 | *
31 | */
32 | public class TestJarLookup {
33 |
34 | public static void main(String[] args) throws URISyntaxException {
35 | System.getProperties().setProperty("de.lohndirekt.print.IppPrintService.uri", "192.168.0.60:631");
36 | testServices();
37 | }
38 |
39 | private static void testServices() throws URISyntaxException {
40 | PrintService[] services = new IppPrintServiceLookup(new URI("ipp://192.168.0.60:631"),"username","password").getPrintServices();
41 | for (int i = 0; i < services.length; i++) {
42 | PrintService service = services[i];
43 | System.out.println(service.getName());
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/MultipleDocumentHandlingSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class MultipleDocumentHandlingSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | /**
29 | * @param value
30 | */
31 | public MultipleDocumentHandlingSupported(String value, Locale locale) {
32 | super(value, locale);
33 | }
34 |
35 | /**
36 | *
37 | */
38 |
39 | public Class getCategory() {
40 | return MultipleDocumentHandlingSupported.class;
41 | }
42 |
43 | public String getName() {
44 | return MultipleDocumentHandlingSupported.getIppName();
45 | }
46 |
47 | /**
48 | *
49 | */
50 |
51 | public final static String getIppName() {
52 | return "multiple-document-handling-supported";
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/JobQuotaPeriod.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 |
25 | public class JobQuotaPeriod extends IntegerSyntax implements PrintServiceAttribute {
26 |
27 | /**
28 | * @param value
29 | */
30 | public JobQuotaPeriod(int value) {
31 | super(value);
32 | }
33 |
34 | /**
35 | * @param value
36 | * @param lowerBound
37 | * @param upperBound
38 | */
39 | public JobQuotaPeriod(int value, int lowerBound, int upperBound) {
40 | super(value, lowerBound, upperBound);
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public Class getCategory() {
48 | return this.getClass();
49 | }
50 |
51 | /**
52 | *
53 | */
54 |
55 | public String getName() {
56 | return JobQuotaPeriod.getIppName();
57 | }
58 |
59 | public static String getIppName(){
60 | return "job-quota-period";
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/NaturalLanguage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintRequestAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class NaturalLanguage extends TextSyntax implements PrintRequestAttribute {
27 |
28 | public final static NaturalLanguage EN = new NaturalLanguage("en", Locale.getDefault());
29 | public final static NaturalLanguage DE = new NaturalLanguage("de", Locale.getDefault());
30 |
31 |
32 |
33 |
34 | /**
35 | * @param value
36 | */
37 | public NaturalLanguage(String value, Locale locale) {
38 | super(value, locale);
39 | }
40 |
41 | /**
42 | *
43 | */
44 |
45 | public Class getCategory() {
46 | return NaturalLanguage.class;
47 | }
48 |
49 | public String getName() {
50 | return NaturalLanguage.getIppName();
51 | }
52 |
53 | /**
54 | *
55 | */
56 |
57 | public final static String getIppName() {
58 | return "attributes-natural-language";
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/Charset.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintRequestAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class Charset extends TextSyntax implements PrintRequestAttribute {
27 |
28 | public final static Charset ISO_8859_1 = new Charset("iso-8859-1", Locale.getDefault());
29 | public final static Charset ISO_8859_15 = new Charset("iso-8859-15", Locale.getDefault());
30 | public final static Charset UTF_8 = new Charset("utf-8", Locale.getDefault());
31 | public final static Charset US_ASCII = new Charset("us-ascii", Locale.getDefault());
32 |
33 | /**
34 | * @param value
35 | */
36 | public Charset(String name, Locale locale) {
37 | super(name, locale);
38 | }
39 |
40 | /**
41 | *
42 | */
43 |
44 | public Class getCategory() {
45 | return Charset.class;
46 | }
47 |
48 | /**
49 | *
50 | */
51 |
52 | public static String getIppName() {
53 | return "attributes-charset";
54 | }
55 |
56 | public String getName() {
57 | return Charset.getIppName();
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/DeviceClass.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.Attribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 |
27 | public class DeviceClass extends TextSyntax implements Attribute {
28 |
29 | public final static DeviceClass FILE = new DeviceClass("file", Locale.getDefault());
30 | public final static DeviceClass DIRECT = new DeviceClass("direct", Locale.getDefault());
31 | public final static DeviceClass SERIAL = new DeviceClass("serial", Locale.getDefault());
32 | public final static DeviceClass NETWORK = new DeviceClass("network", Locale.getDefault());
33 |
34 | /**
35 | * @param value
36 | * @param locale
37 | */
38 | public DeviceClass(String value, Locale locale) {
39 | super(value, locale);
40 | }
41 |
42 | /**
43 | *
44 | */
45 |
46 | public Class getCategory() {
47 | return this.getClass();
48 | }
49 |
50 | /**
51 | *
52 | */
53 |
54 | public String getName() {
55 | return DeviceClass.getIppName();
56 | }
57 |
58 | /**
59 | *
60 | */
61 | public static String getIppName() {
62 | return "device-class";
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/LastDocument.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp;
20 |
21 | import javax.print.attribute.DocAttribute;
22 | import javax.print.attribute.EnumSyntax;
23 |
24 | public class LastDocument extends EnumSyntax implements DocAttribute {
25 |
26 | public final static LastDocument FALSE = new LastDocument(0);
27 | public final static LastDocument TRUE = new LastDocument(1);
28 |
29 | /**
30 | *
31 | */
32 | protected EnumSyntax[] getEnumValueTable() {
33 | return new EnumSyntax[] { FALSE, TRUE};
34 | }
35 |
36 | /**
37 | *
38 | */
39 | protected int getOffset() {
40 | return 0;
41 | }
42 |
43 | /**
44 | *
45 | */
46 | protected String[] getStringTable() {
47 | return new String[] { "false", "true" };
48 | }
49 |
50 | /**
51 | * @param value
52 | */
53 | public LastDocument(int value) {
54 | super(value);
55 | }
56 |
57 | /**
58 | *
59 | */
60 | public Class getCategory() {
61 | return this.getClass();
62 | }
63 |
64 | /**
65 | *
66 | */
67 | public String getName() {
68 | return LastDocument.getIppName();
69 | }
70 |
71 | /**
72 | * @return
73 | */
74 | public static String getIppName() {
75 | return "last-document";
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/UriSecuritySupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class UriSecuritySupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | public static UriSecuritySupported NONE = new UriSecuritySupported("none", Locale.getDefault());
29 | public static UriSecuritySupported SSl3 =
30 | new UriSecuritySupported("ssl3", Locale.getDefault());
31 | public static UriSecuritySupported TSL = new UriSecuritySupported("tsl", Locale.getDefault());
32 |
33 | /**
34 | * @param value
35 | * @param locale
36 | */
37 | public UriSecuritySupported(String value, Locale locale) {
38 | super(value, locale);
39 | }
40 |
41 | /**
42 | *
43 | */
44 |
45 | public Class getCategory() {
46 | return this.getClass();
47 | }
48 |
49 | /**
50 | *
51 | */
52 |
53 | public String getName() {
54 | return UriSecuritySupported.getIppName();
55 | }
56 |
57 | /**
58 | * @return
59 | */
60 | public static String getIppName() {
61 | return "uri-security-supported";
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/PageRangesSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
19 |
20 | import javax.print.attribute.EnumSyntax;
21 | import javax.print.attribute.SupportedValuesAttribute;
22 |
23 |
24 | public class PageRangesSupported extends EnumSyntax implements SupportedValuesAttribute {
25 |
26 | public static final PageRangesSupported NOT_SUPPORTED = new PageRangesSupported(0);
27 | public static final PageRangesSupported SUPPORTED = new PageRangesSupported(1);
28 |
29 | /**
30 | *
31 | */
32 |
33 | protected EnumSyntax[] getEnumValueTable() {
34 | return new EnumSyntax[]{
35 | NOT_SUPPORTED,
36 | SUPPORTED
37 |
38 | };
39 | }
40 |
41 | /**
42 | *
43 | */
44 |
45 | protected int getOffset() {
46 | return 0;
47 | }
48 |
49 | /**
50 | *
51 | */
52 |
53 | protected String[] getStringTable() {
54 | return new String[]{
55 | "supported" ,
56 | "not supported"
57 | };
58 | }
59 |
60 | /**
61 | * @param value
62 | */
63 | public PageRangesSupported(int value) {
64 | super(value);
65 | }
66 |
67 | /**
68 | *
69 | */
70 |
71 | public Class getCategory() {
72 | return this.getClass();
73 | }
74 |
75 | /**
76 | *
77 | */
78 |
79 | public String getName() {
80 | return PageRangesSupported.getIppName();
81 | }
82 |
83 | /**
84 | *
85 | */
86 | public static String getIppName() {
87 | return "page-ranges-supported";
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/IppDelimiterTag.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute;
20 |
21 | /**
22 | *Bezeichnungen bernommen aus www.ietf.org/rfc/rfc2910.txt
23 | *Tags ohne Bezeichnung sind dort nicht aufgefhrt, werden aber in der Cups-API verwendet
24 | */
25 | public class IppDelimiterTag {
26 |
27 | private String description = "";
28 | private int value = 0;
29 |
30 | public static final IppDelimiterTag ZERO = new IppDelimiterTag(0x00, "");
31 | public static final IppDelimiterTag BEGIN_OPERATION_ATTRIBUTES = new IppDelimiterTag(0x01, "operation-attributes-tag");
32 | public static final IppDelimiterTag BEGIN_JOB_ATTRIBUTES = new IppDelimiterTag(0x02, "job-attributes-tag");
33 | public static final IppDelimiterTag END_ATTRIBUTES = new IppDelimiterTag(0x03, "end-of-attributes-tag");
34 | public static final IppDelimiterTag BEGIN_PRINTER_ATTRIBUTES = new IppDelimiterTag(0x04, "printer-attributes-tag");
35 | public static final IppDelimiterTag UNSUPPORTED_GROUP = new IppDelimiterTag(0x05, "unsupported-attributes-tag");
36 | public static final IppDelimiterTag SUBSCRIPTION = new IppDelimiterTag(0x06, "");
37 | public static final IppDelimiterTag EVENT_NOTIFICATION = new IppDelimiterTag(0x07, "");
38 |
39 | private IppDelimiterTag(int value, String description) {
40 | this.value = value;
41 | this.description = description;
42 | }
43 |
44 | public int getValue(){
45 | return this.value;
46 | }
47 |
48 | public String toString(){
49 | return this.description;
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/test/attribute/IppAttributeNameTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.test.attribute;
20 |
21 | import java.util.Locale;
22 |
23 | import de.lohndirekt.print.attribute.IppAttributeName;
24 | import junit.framework.TestCase;
25 | import de.lohndirekt.print.attribute.ipp.UnknownAttribute;
26 |
27 | /**
28 | * @author bpusch
29 | *
30 | *
31 | */
32 | public class IppAttributeNameTest extends TestCase {
33 |
34 | /**
35 | * Constructor for IppAttributeNameTest.
36 | * @param name
37 | */
38 | public IppAttributeNameTest(String name) {
39 | super(name);
40 | }
41 |
42 |
43 | /*
44 | * Test for IppAttributeName get(String)
45 | */
46 | public void testGetString() {
47 | IppAttributeName attributeName = IppAttributeName.get("attribute-does-not-exist");
48 | assertNotNull("IppAttributeName is null",attributeName);
49 | assertEquals("IppAttributeName should be UNKNOWN_ATTRIBUTE", attributeName.getCategory(), new UnknownAttribute("x",Locale.getDefault()).getCategory());
50 | }
51 |
52 | /*
53 | * Test for IppAttributeName get(Class)
54 | */
55 | public void testGetClass() {
56 | IppAttributeName attributeName = IppAttributeName.get(String.class);
57 | assertNotNull("IppAttributeName is null",attributeName);
58 | assertEquals("IppAttributeName should be UNKNOWN_ATTRIBUTE", attributeName.getCategory(), new UnknownAttribute("x",Locale.getDefault()).getCategory());
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/UriAuthenticationSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.SupportedValuesAttribute;
24 | import javax.print.attribute.TextSyntax;
25 |
26 | public class UriAuthenticationSupported extends TextSyntax implements SupportedValuesAttribute {
27 |
28 | public static UriAuthenticationSupported NONE = new UriAuthenticationSupported("none", Locale.getDefault());
29 | public static UriAuthenticationSupported REQUESTING_USER_NAME =
30 | new UriAuthenticationSupported("requesting-user-name", Locale.getDefault());
31 | public static UriAuthenticationSupported BASIC = new UriAuthenticationSupported("basic", Locale.getDefault());
32 | public static UriAuthenticationSupported DIGEST = new UriAuthenticationSupported("digest", Locale.getDefault());
33 | public static UriAuthenticationSupported CERTIFICATION = new UriAuthenticationSupported("certification", Locale.getDefault());
34 |
35 | /**
36 | * @param value
37 | * @param locale
38 | */
39 | public UriAuthenticationSupported(String value, Locale locale) {
40 | super(value, locale);
41 | }
42 |
43 | /**
44 | *
45 | */
46 |
47 | public Class getCategory() {
48 | return this.getClass();
49 | }
50 |
51 | /**
52 | *
53 | */
54 |
55 | public String getName() {
56 | return UriAuthenticationSupported.getIppName();
57 | }
58 |
59 | /**
60 | * @return
61 | */
62 | public static String getIppName() {
63 | return "uri-authentication-supported";
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/printerdesc/supported/MultipleDocumentJobsSupported.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.printerdesc.supported;
20 |
21 | import javax.print.attribute.EnumSyntax;
22 | import javax.print.attribute.SupportedValuesAttribute;
23 |
24 |
25 | public class MultipleDocumentJobsSupported extends EnumSyntax implements SupportedValuesAttribute {
26 |
27 | public final static MultipleDocumentJobsSupported NOT_SUPPORTED = new MultipleDocumentJobsSupported(0);
28 | public final static MultipleDocumentJobsSupported SUPPORTED = new MultipleDocumentJobsSupported(1);
29 |
30 |
31 | /**
32 | *
33 | */
34 |
35 | protected EnumSyntax[] getEnumValueTable() {
36 | return new EnumSyntax[]{
37 | NOT_SUPPORTED,
38 | SUPPORTED
39 | };
40 | }
41 |
42 | /**
43 | *
44 | */
45 |
46 | protected int getOffset() {
47 | return 0;
48 | }
49 |
50 | /**
51 | *
52 | */
53 |
54 | protected String[] getStringTable() {
55 | return new String[]{
56 | "not supported",
57 | "supported"
58 | };
59 | }
60 |
61 | /**
62 | * @param value
63 | */
64 | public MultipleDocumentJobsSupported(int value) {
65 | super(value);
66 | }
67 |
68 | /**
69 | *
70 | */
71 |
72 | public Class getCategory() {
73 | return this.getClass();
74 | }
75 |
76 | /**
77 | *
78 | */
79 |
80 | public String getName() {
81 | return MultipleDocumentJobsSupported.getIppName();
82 | }
83 |
84 | /**
85 | * @return
86 | */
87 | public static String getIppName() {
88 | return "multiple-document-jobs-supported";
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/test/IppPrintServiceLookupTest.java:
--------------------------------------------------------------------------------
1 | package com.xinterium.jspi.test;
2 |
3 | import java.util.Locale;
4 |
5 | import javax.print.DocFlavor;
6 | import javax.print.PrintService;
7 | import javax.print.attribute.AttributeSet;
8 | import javax.print.attribute.HashAttributeSet;
9 | import javax.print.attribute.standard.RequestingUserName;
10 |
11 | import de.lohndirekt.print.IppPrintServiceLookup;
12 | import de.lohndirekt.print.Messages;
13 | import de.lohndirekt.print.attribute.auth.RequestingUserPassword;
14 |
15 | import junit.framework.TestCase;
16 |
17 | /**
18 | * @author bpusch
19 | *
20 | */
21 | public class IppPrintServiceLookupTest extends TestCase {
22 |
23 | /**
24 | * Constructor for IppPrintServiceLookupTest.
25 | * @param name
26 | */
27 | public IppPrintServiceLookupTest(String name) {
28 | super(name);
29 | }
30 |
31 | /*
32 | * @see TestCase#setUp()
33 | */
34 | protected void setUp() throws Exception {
35 | super.setUp();
36 | //setting cups properties
37 | System.getProperties().setProperty(IppPrintServiceLookup.URI_KEY, Messages.getString("cups.uri")); //$NON-NLS-1$
38 | System.getProperties().setProperty(IppPrintServiceLookup.USERNAME_KEY, Messages.getString("cups.username")); //$NON-NLS-1$
39 | System.getProperties().setProperty(IppPrintServiceLookup.PASSWORD_KEY, Messages.getString("cups.password")); //$NON-NLS-1$
40 | System.getProperties().setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); //$NON-NLS-1$
41 | System.getProperties().setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
42 | System.getProperties().setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
43 | System.getProperties().setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
44 | }
45 |
46 | // public void testGetServices(){
47 | // PrintService[] services = new IppPrintServiceLookup().getPrintServices(DocFlavor.INPUT_STREAM.POSTSCRIPT ,null);
48 | // assertTrue(services.length>0);
49 | //
50 | // //IppPrintServiceLookup must not return any pageable enabled services
51 | // services = new IppPrintServiceLookup().getPrintServices(DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
52 | // assertEquals(0,services.length);
53 | // }
54 |
55 |
56 |
57 | public void testGetServicesAuthenticated(){
58 | RequestingUserName user = new RequestingUserName(Messages.getString("cups.username"), Locale.GERMANY);
59 | RequestingUserPassword pass = new RequestingUserPassword(Messages.getString("cups.password"), Locale.GERMANY);
60 |
61 | AttributeSet set = new HashAttributeSet();
62 | set.add(user);
63 | set.add(pass);
64 |
65 | PrintService[] services = new IppPrintServiceLookup().getPrintServices(DocFlavor.INPUT_STREAM.POSTSCRIPT ,null);
66 | assertTrue(services.length>0);
67 |
68 |
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/CancelableJob.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */package de.lohndirekt.print;
19 |
20 | import java.io.IOException;
21 | import java.util.logging.Level;
22 |
23 | import javax.print.CancelablePrintJob;
24 | import javax.print.PrintException;
25 | import javax.print.attribute.AttributeSet;
26 | import javax.print.attribute.HashAttributeSet;
27 | import javax.print.event.PrintJobEvent;
28 |
29 | import de.lohndirekt.print.attribute.IppStatus;
30 | import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;
31 |
32 | /**
33 | * @author bpusch
34 | *
35 | */
36 | class CancelableJob extends Job implements CancelablePrintJob{
37 |
38 |
39 | /**
40 | * @param service
41 | */
42 | public CancelableJob(IppPrintService service) {
43 | super(service);
44 | }
45 |
46 | public void cancel() throws PrintException {
47 | if (!ok) {
48 | throw new PrintException("Job has not been sent. Cannot be canceled");
49 | }
50 | AttributeSet operationAttributes = new HashAttributeSet();
51 | operationAttributes.add(this.jobUri);
52 | try {
53 | IppResponse response =
54 | sendRequest(
55 | OperationsSupported.CANCEL_JOB,
56 | operationAttributes);
57 | if (response.getStatus().equals(IppStatus.SUCCESSFUL_OK)
58 | || response.getStatus().equals(
59 | IppStatus.SUCCESSFUL_OK_CONFLICTING_ATTRIBUTES)
60 | || response.getStatus().equals(
61 | IppStatus.SUCCESSFUL_OK_CONFLICTING_ATTRIBUTES)) {
62 | notifyJobListeners(PrintJobEvent.JOB_CANCELED);
63 | }
64 | } catch (IOException e) {
65 | log.log(Level.SEVERE, e.getMessage(), e);
66 | throw new PrintException("Cannot be canceled: IOException", e);
67 | }
68 | }
69 |
70 |
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppRequestFactory.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.lang.reflect.Constructor;
22 | import java.net.URI;
23 |
24 | import javax.print.attribute.AttributeSet;
25 | import javax.print.attribute.HashAttributeSet;
26 | import javax.print.attribute.standard.RequestingUserName;
27 |
28 | import de.lohndirekt.print.attribute.auth.RequestingUserPassword;
29 | import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;
30 |
31 | /**
32 | * @author bpusch
33 | *
34 | */
35 | public final class IppRequestFactory {
36 |
37 | public final static String IPP_REQUEST_IMPL_KEY = "de.lohndirekt.print.IppRequest.Impl";
38 |
39 | final static IppRequest createIppRequest(URI uri,
40 | OperationsSupported operation, RequestingUserName user,
41 | RequestingUserPassword passwd) {
42 | String requestClassName = System.getProperty(IPP_REQUEST_IMPL_KEY);
43 | IppRequest request = null;
44 | if (requestClassName == null) {
45 | request = new IppRequestCupsImpl(uri, operation);
46 | } else {
47 | Class clazz = null;
48 | try {
49 | clazz = Class.forName(requestClassName);
50 | } catch (ClassNotFoundException e) {
51 | throw new IllegalArgumentException("Class " + requestClassName
52 | + " does not exist.");
53 | }
54 |
55 | try {
56 | Constructor constructor = clazz
57 | .getDeclaredConstructor(URI.class,
58 | OperationsSupported.class);
59 | request = (IppRequest) constructor.newInstance(uri, operation);
60 | } catch (Exception e) {
61 | throw new RuntimeException(e);
62 | }
63 | }
64 | if (user != null && passwd != null) {
65 | AttributeSet set = new HashAttributeSet();
66 | set.add(user);
67 | set.add(passwd);
68 | request.addOperationAttributes(set);
69 | }
70 | return request;
71 | }
72 | }
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/ipp/jobtempl/LdJobHoldUntil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.ipp.jobtempl;
20 |
21 | import java.util.Locale;
22 |
23 | import javax.print.attribute.PrintJobAttribute;
24 | import javax.print.attribute.PrintRequestAttribute;
25 | import javax.print.attribute.TextSyntax;
26 |
27 | /**
28 | * The job-hold-until attribute specifies a hold time.
29 | * In addition to the standard IPP/1.1 keyword names,
30 | * CUPS supports name values of the form "HH:MM" and "HH:MM:SS"
31 | * that specify a hold time.
32 | * The hold time is in Greenwich Mean Time (GMT) and not in the
33 | * local time zone. If the specified time is less than the
34 | * current time, the job is held until the next day.
35 | *
36 | * @author bpusch
37 | */
38 | public class LdJobHoldUntil extends TextSyntax implements PrintRequestAttribute, PrintJobAttribute {
39 |
40 | public final static LdJobHoldUntil NO_HOLD = new LdJobHoldUntil("no-hold",Locale.getDefault());
41 | public final static LdJobHoldUntil INDEFINITE = new LdJobHoldUntil("indefinite",Locale.getDefault());
42 | public final static LdJobHoldUntil DAY_TIME = new LdJobHoldUntil("day-time",Locale.getDefault());
43 | public final static LdJobHoldUntil EVENING = new LdJobHoldUntil("evening",Locale.getDefault());
44 | public final static LdJobHoldUntil NIGHT = new LdJobHoldUntil("night",Locale.getDefault());
45 | public final static LdJobHoldUntil WEEKEND = new LdJobHoldUntil("weekend",Locale.getDefault());
46 | public final static LdJobHoldUntil SECOND_SHIFT = new LdJobHoldUntil("second-shift",Locale.getDefault());
47 | public final static LdJobHoldUntil THIRD_SHIFT = new LdJobHoldUntil("third-shift",Locale.getDefault());
48 |
49 | /**
50 | * @param value
51 | * @param locale
52 | */
53 | public LdJobHoldUntil(String value, Locale locale) {
54 | super(value, locale);
55 | }
56 |
57 | public Class getCategory() {
58 | return LdJobHoldUntil.class;
59 | }
60 |
61 | public String getName() {
62 | return LdJobHoldUntil.getIppName();
63 | }
64 |
65 |
66 | public final static String getIppName() {
67 | return "job-hold-until";
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/test/IppRequestTestImplTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.test;
20 |
21 | import java.io.IOException;
22 | import java.net.URI;
23 | import java.net.URISyntaxException;
24 | import java.util.Iterator;
25 | import java.util.Locale;
26 | import java.util.Map;
27 | import java.util.Set;
28 |
29 | import javax.print.attribute.Attribute;
30 |
31 | import de.lohndirekt.print.IppRequestTestImpl;
32 | import junit.framework.TestCase;
33 | import de.lohndirekt.print.IppRequest;
34 | import de.lohndirekt.print.attribute.IppAttributeName;
35 | import de.lohndirekt.print.attribute.ipp.UnknownAttribute;
36 | import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;
37 | import org.junit.Assert;
38 |
39 | /**
40 | * @author bpusch
41 | *
42 | *
43 | */
44 | public class IppRequestTestImplTest extends TestCase {
45 |
46 | public void testSendGetPrinterAttributes() throws URISyntaxException, IOException {
47 | Class unknownAttributeCategory = new UnknownAttribute("x", Locale.getDefault()).getCategory();
48 | IppRequest request = new IppRequestTestImpl(new URI("http://127.0.0.1"), OperationsSupported.GET_PRINTER_ATTRIBUTES);
49 | Map attributes = request.send().getAttributes();
50 | for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) {
51 | Class category = (Class) iter.next();
52 | //Should not return any unknown Attributes
53 | Assert.assertFalse(category.equals(unknownAttributeCategory));
54 | Set attrs = (Set) attributes.get(category);
55 | Assert.assertNotNull(attrs);
56 | for (Iterator iterator = attrs.iterator(); iterator.hasNext();) {
57 | Attribute element = (Attribute) iterator.next();
58 | Assert.assertEquals(category, element.getCategory());
59 | }
60 | }
61 | }
62 |
63 | public void testSendCupsGetPrinter() throws URISyntaxException, IOException {
64 | IppRequest request = new IppRequestTestImpl(new URI("http://127.0.0.1"), OperationsSupported.CUPS_GET_PRINTERS);
65 | Map attributes = request.send().getAttributes();
66 | Assert.assertTrue("Response must contain an attribute of category printer-uri-spported",attributes.containsKey(IppAttributeName.PRINTER_URI_SUPPORTED.getCategory()));
67 | }
68 |
69 | public void testGetResponse() throws URISyntaxException, IOException {
70 | //response is now returned by send()
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppServer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.io.IOException;
22 | import java.net.URI;
23 | import java.util.ArrayList;
24 | import java.util.Iterator;
25 | import java.util.List;
26 | import java.util.Set;
27 | import java.util.logging.Level;
28 | import java.util.logging.Logger;
29 |
30 | import javax.print.attribute.Attribute;
31 | import javax.print.attribute.URISyntax;
32 | import javax.print.attribute.standard.RequestingUserName;
33 |
34 | import de.lohndirekt.print.attribute.IppAttributeName;
35 | import de.lohndirekt.print.attribute.auth.RequestingUserPassword;
36 | import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;
37 |
38 | /**
39 | * @author bpusch
40 | *
41 | */
42 | class IppServer {
43 |
44 | private final Logger log = Logger.getLogger(this.getClass().getName());
45 | private URI uri;
46 | private RequestingUserName user;
47 | private RequestingUserPassword passwd;
48 |
49 | IppServer(URI uri, RequestingUserName user, RequestingUserPassword passwd) {
50 | this.uri = uri;
51 | this.user = user;
52 | this.passwd = passwd;
53 | }
54 |
55 | /**
56 | * @return a list of all PrintServices (printers as well as classes)
57 | * known to the CUPS server
58 | */
59 | List getPrintServices() {
60 | List services = new ArrayList();
61 | services.addAll(getServices(OperationsSupported.CUPS_GET_PRINTERS,user,passwd));
62 | services.addAll(getServices(OperationsSupported.CUPS_GET_CLASSES,user,passwd));
63 | return services;
64 | }
65 |
66 | private List getServices(OperationsSupported operation,RequestingUserName user, RequestingUserPassword passwd){
67 | if (!(operation==OperationsSupported.CUPS_GET_CLASSES || operation == OperationsSupported.CUPS_GET_PRINTERS)){
68 | throw new IllegalArgumentException("Operation not applicable");
69 | }
70 | IppResponse response = null;
71 | IppRequest request = IppRequestFactory.createIppRequest(this.uri, operation,user,passwd);
72 | try {
73 | response = request.send();
74 | } catch (IOException e) {
75 | log.log(Level.SEVERE, e.getMessage(),e);
76 | }
77 | List services = new ArrayList();
78 | if (response != null) {
79 | Set uriAttributes = (Set)response.getAttributes().get(IppAttributeName.PRINTER_URI_SUPPORTED.getCategory());
80 | if (uriAttributes != null) {
81 | for (Iterator iter = uriAttributes.iterator(); iter.hasNext();) {
82 | Attribute attribute = (Attribute)iter.next();
83 | URI printerUri = ((URISyntax)attribute).getURI();
84 | IppPrintService service = new IppPrintService(printerUri);
85 | service.setRequestingUserName(user);
86 | service.setRequestingUserPassword(passwd);
87 | services.add(service);
88 | }
89 | }
90 | }
91 | return services;
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/jspi-web/src/main/java/com/xinterium/jspi/web/IppServlet.java:
--------------------------------------------------------------------------------
1 | package com.xinterium.jspi.web;
2 |
3 | import java.io.ByteArrayOutputStream;
4 | import java.io.FileOutputStream;
5 | import java.io.IOException;
6 | import java.io.InputStream;
7 | import java.net.URI;
8 | import java.net.URISyntaxException;
9 | import java.util.Enumeration;
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | import javax.servlet.ServletException;
14 | import javax.servlet.ServletInputStream;
15 | import javax.servlet.http.HttpServlet;
16 | import javax.servlet.http.HttpServletRequest;
17 | import javax.servlet.http.HttpServletResponse;
18 |
19 | import de.lohndirekt.print.attribute.IppStatus;
20 | import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;
21 | import de.lohndirekt.print.attribute.ipp.printerdesc.supported.PrinterUriSupported;
22 |
23 | /**
24 | * Servlet implementation class IppServlet
25 | */
26 | public class IppServlet extends HttpServlet {
27 | private static final long serialVersionUID = 1L;
28 |
29 | private Map attributes;
30 | private OperationsSupported operationId;
31 | private byte[] jobdata;
32 |
33 | /**
34 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
35 | */
36 | @Override
37 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
38 |
39 | System.out.println("");
40 | System.out.println("H E A D E R S");
41 | System.out.println("");
42 | Enumeration headerNames = request.getHeaderNames();
43 | while (headerNames.hasMoreElements()) {
44 | String headerName = (String) headerNames.nextElement();
45 | System.out
46 | .println(headerName + ":" + request.getHeader(headerName));
47 | }
48 | System.out.println("");
49 | System.out.println("B O D Y");
50 | System.out.println("");
51 | ServletInputStream inputStream = request.getInputStream();
52 | parseRequest(inputStream);
53 | System.out.println("Operazione richiesta : 0x"
54 | + Integer.toHexString(this.operationId.getValue()));
55 | if (this.operationId.getValue() == OperationsSupported.CUPS_GET_PRINTERS
56 | .getValue()) {
57 | IppResponseIppImpl ippresponse = new IppResponseIppImpl(
58 | IppStatus.SUCCESSFUL_OK);
59 | try {
60 | ippresponse.getPrinterAttributes().add(
61 | new PrinterUriSupported(new URI(
62 | "http://127.0.0.1:9090/ipp/IppServlet")));
63 | } catch (URISyntaxException e) {
64 | e.printStackTrace();
65 | }
66 | ippresponse.write(response.getOutputStream());
67 | }
68 |
69 | if (this.operationId.getValue() == OperationsSupported.PRINT_JOB
70 | .getValue()) {
71 | IppResponseIppImpl ippresponse = new IppResponseIppImpl(
72 | IppStatus.SUCCESSFUL_OK);
73 | ippresponse.write(response.getOutputStream());
74 | java.io.File tempFile = java.io.File
75 | .createTempFile("unijob", "tmp");
76 | FileOutputStream faos = new FileOutputStream(tempFile);
77 | faos.write(this.jobdata);
78 | faos.close();
79 | System.out.println("Scritti : [" + this.jobdata.length
80 | + "] bytes in : [" + tempFile.getAbsolutePath() + "]");
81 | }
82 |
83 | response.getOutputStream().close();
84 | }
85 |
86 | private void parseRequest(InputStream request) throws IOException {
87 | byte[] header = new byte[8];
88 | request.read(header);
89 | this.operationId = new OperationsSupported((header[2] << 8) + header[3]);
90 | if (request.available() != 0) {
91 | this.attributes = AttributeParser.parseRequest(request);
92 | } else {
93 | this.attributes = new HashMap();
94 | }
95 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
96 | while (request.available() != 0) {
97 | baos.write(request.read());
98 | }
99 | baos.close();
100 | this.jobdata = baos.toByteArray();
101 | request.close();
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/IppValueTag.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute;
20 |
21 | /**
22 | *Bezeichnungen bernommen aus www.ietf.org/rfc/rfc2910.txt
23 | *Tags ohne Bezeichnung sind dort nicht aufgefhrt, werden aber in der Cups-API verwendet
24 | */
25 | public class IppValueTag {
26 |
27 | private String description;
28 | private int value = 0;
29 |
30 | public static final IppValueTag UNSUPPORTED_VALUE = new IppValueTag(0x10, "unsupported");
31 | public static final IppValueTag DEFAULT = new IppValueTag(0x11, "'default' ");
32 | public static final IppValueTag UNKNOWN = new IppValueTag(0x12, "unknown");
33 | public static final IppValueTag NOVALUE = new IppValueTag(0x13, "no-value");
34 | public static final IppValueTag NOTSETTABLE = new IppValueTag(0x15, "");
35 | public static final IppValueTag DELETEATTR = new IppValueTag(0x16, "");
36 | public static final IppValueTag ADMINDEFINE = new IppValueTag(0x17, "");
37 | public static final IppValueTag INTEGER = new IppValueTag(0x21, "integer");
38 | public static final IppValueTag BOOLEAN = new IppValueTag(0x22, "boolean");
39 | public static final IppValueTag ENUM = new IppValueTag(0x23, "enum");
40 | public static final IppValueTag STRING = new IppValueTag(0x30, "octetString");
41 | public static final IppValueTag DATE = new IppValueTag(0x31, "dateTime");
42 | public static final IppValueTag RESOLUTION = new IppValueTag(0x32, "resolution");
43 | public static final IppValueTag RANGE = new IppValueTag(0x33, "rangeOfInteger");
44 | public static final IppValueTag BEGIN_COLLECTION = new IppValueTag(0x34, "");
45 | public static final IppValueTag TEXTLANG = new IppValueTag(0x35, "resolution");
46 | public static final IppValueTag NAMELANG = new IppValueTag(0x36, "nameWithLanguage");
47 | public static final IppValueTag END_COLLECTION = new IppValueTag(0x37, "");
48 | public static final IppValueTag TEXT = new IppValueTag(0x41, "textWithoutLanguage");
49 | public static final IppValueTag NAME = new IppValueTag(0x42, "nameWithoutLanguage");
50 | public static final IppValueTag KEYWORD = new IppValueTag(0x44, "keyword");
51 | public static final IppValueTag URI = new IppValueTag(0x45, "uri");
52 | public static final IppValueTag URISCHEME = new IppValueTag(0x46, "uriScheme");
53 | public static final IppValueTag CHARSET = new IppValueTag(0x47, "charset");
54 | public static final IppValueTag LANGUAGE = new IppValueTag(0x48, "naturalLanguage");
55 | public static final IppValueTag MIMETYPE = new IppValueTag(0x49, "mimeMediaType");
56 | public static final IppValueTag MEMBERNAME = new IppValueTag(0x4A, "");
57 | public static final IppValueTag MASK = new IppValueTag(0x7FFFFFFF, "");
58 | public static final IppValueTag COPY = new IppValueTag(0x80000001, "");
59 |
60 | private IppValueTag(int value, String description) {
61 | this.value = value;
62 | this.description = description;
63 | }
64 |
65 | public int getValue() {
66 | return this.value;
67 | }
68 |
69 |
70 | public String toString() {
71 | return this.description;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/SimpleMultiDoc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.io.IOException;
22 | import java.util.ArrayList;
23 | import java.util.Iterator;
24 | import java.util.List;
25 |
26 | import javax.print.Doc;
27 | import javax.print.MultiDoc;
28 |
29 | /**
30 | * @author bpusch
31 | *
32 | */
33 | public class SimpleMultiDoc implements MultiDoc {
34 |
35 | private List listeners;
36 | Doc doc = null;
37 | boolean lastDoc = false;
38 | SimpleMultiDoc next = null;
39 |
40 | public static SimpleMultiDoc create(Doc doc) {
41 | return new SimpleMultiDoc(doc, false);
42 | }
43 |
44 | public static SimpleMultiDoc create(Doc doc, boolean lastDoc) {
45 | return new SimpleMultiDoc(doc, lastDoc);
46 | }
47 |
48 | /**
49 | *
50 | */
51 | protected SimpleMultiDoc(Doc doc, boolean lastDoc) {
52 | if (doc == null) {
53 | throw new NullPointerException("Doc must not be null");
54 | }
55 | this.doc = doc;
56 | this.lastDoc = lastDoc;
57 | }
58 |
59 | /**
60 | * Adds a new MultiDoc.
61 | * If the next MultiDoc has already been set, it tries to add it there
62 | *
63 | * @param doc
64 | * @param lastDoc
65 | * @throws IllegalStateException if this has already been the last Document
66 | */
67 | public void setNext(Doc doc, boolean lastDoc) {
68 | if (this.lastDoc) {
69 | throw new IllegalStateException("Last Doc already sent");
70 | }
71 | if (doc == null) {
72 | throw new NullPointerException("Doc must not be null");
73 | }
74 | if (next == null) {
75 | this.next = new SimpleMultiDoc(doc, lastDoc);
76 | } else {
77 | this.next.setNext(doc, lastDoc);
78 | }
79 | this.notifyListeners();
80 | }
81 |
82 | public void setNext(Doc doc) {
83 | setNext(doc, false);
84 | }
85 |
86 | /**
87 | *
88 | */
89 |
90 | public Doc getDoc() throws IOException {
91 | return this.doc;
92 | }
93 |
94 | /**
95 | *
96 | */
97 | public MultiDoc next() throws IOException {
98 | if (!this.available()) {
99 | throw new IllegalStateException("Next MultiDoc is not yet available");
100 | }
101 | return this.next;
102 | }
103 |
104 | public boolean available() {
105 | return (!this.lastDoc && this.next != null);
106 | }
107 |
108 | public boolean isLast() {
109 | return lastDoc;
110 | }
111 |
112 | public String toString() {
113 | return this.getClass() + " - " + this.doc.toString();
114 | }
115 |
116 | public void addMultiDocListener(MultiDocListener listener) {
117 | if (this.listeners == null) {
118 | this.listeners = new ArrayList();
119 | }
120 | this.listeners.add(listener);
121 | }
122 |
123 | private void notifyListeners() {
124 | if (this.listeners != null) {
125 | for (Iterator iter = this.listeners.iterator(); iter.hasNext();) {
126 | MultiDocListener listener = (MultiDocListener) iter.next();
127 | try {
128 | listener.processEvent(new MultiDocEvent(this.next));
129 | } catch (IOException e) {
130 | //TODO handle exception appropriatly
131 | }
132 | }
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/attribute/cups/PrinterType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print.attribute.cups;
20 |
21 | import javax.print.attribute.IntegerSyntax;
22 | import javax.print.attribute.PrintServiceAttribute;
23 |
24 | public class PrinterType extends IntegerSyntax implements PrintServiceAttribute {
25 |
26 | public static final int IS_PRINTER_CLASS = 1 << 0;
27 | public static final int IS_REMOTE_DESTINATION = 1 << 1;
28 | public static final int CAN_BLACK = 1 << 2;
29 | public static final int CAN_COLOR = 1 << 3;
30 | public static final int CAN_DUPLEX = 1 << 4;
31 | public static final int CAN_STAPLE = 1 << 5;
32 | public static final int CAN_UNCOLLATED = 1 << 6;
33 | public static final int CAN_COLLATED = 1 << 7;
34 | public static final int CAN_PUNCH = 1 << 8;
35 | public static final int CAN_COVER = 1 << 9;
36 | public static final int CAN_BIND = 1 << 10;
37 | public static final int CAN_SORT = 1 << 11;
38 | public static final int CAN_A4 = 1 << 12;
39 | public static final int CAN_A2 = 1 << 13;
40 | public static final int CAN_LARGER_A2 = 1 << 14;
41 | public static final int CAN_USER_DEFINED_MEDIA_SIZE = 1 << 15;
42 | public static final int IS_IMPLICIT_CLASS = 1 << 16;
43 |
44 | public boolean isPrinterClass() {
45 | return (getValue() & IS_PRINTER_CLASS) == 1;
46 | }
47 |
48 | public boolean isRemoteDestination() {
49 | return (getValue() & IS_REMOTE_DESTINATION) == 1;
50 | }
51 |
52 | public boolean canPrintBlack() {
53 | return (getValue() & CAN_BLACK) == 1;
54 | }
55 |
56 | public boolean canPrintColor() {
57 | return (getValue() & CAN_COLOR) == 1;
58 | }
59 |
60 | public boolean canDuplex() {
61 | return (getValue() & CAN_DUPLEX) == 1;
62 | }
63 |
64 | public boolean canStaple() {
65 | return (getValue() & CAN_STAPLE) == 1;
66 | }
67 |
68 | public boolean canUncollated() {
69 | return (getValue() & CAN_UNCOLLATED) == 1;
70 | }
71 |
72 | public boolean canCollated() {
73 | return (getValue() & CAN_COLLATED) == 1;
74 | }
75 |
76 | public boolean canPunch() {
77 | return (getValue() & CAN_PUNCH) == 1;
78 | }
79 |
80 | public boolean canCover() {
81 | return (getValue() & CAN_COVER) == 1;
82 | }
83 |
84 | public boolean canBind() {
85 | return (getValue() & CAN_BIND) == 1;
86 | }
87 |
88 | public boolean canSort() {
89 | return (getValue() & CAN_SORT) == 1;
90 | }
91 |
92 | public boolean canA4() {
93 | return (getValue() & CAN_A4) == 1;
94 | }
95 |
96 | public boolean canA2() {
97 | return (getValue() & CAN_A2) == 1;
98 | }
99 | public boolean canLargerA2() {
100 | return (getValue() & CAN_LARGER_A2) == 1;
101 | }
102 |
103 | public boolean canUserDefinedMediaSize() {
104 | return (getValue() & CAN_USER_DEFINED_MEDIA_SIZE) == 1;
105 | }
106 | public boolean isImplicitClass() {
107 | return (getValue() & IS_IMPLICIT_CLASS) == 1;
108 | }
109 |
110 |
111 | /**
112 | * @param value
113 | */
114 | public PrinterType(int value) {
115 | super(value);
116 | }
117 |
118 | /**
119 | *
120 | */
121 |
122 | public Class getCategory() {
123 | return this.getClass();
124 | }
125 |
126 | /**
127 | *
128 | */
129 |
130 | public String getName() {
131 | return PrinterType.getIppName();
132 | }
133 |
134 | /**
135 | *
136 | */
137 | public static final String getIppName() {
138 | return "printer-type";
139 | }
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/jspi-web/src/main/java/com/xinterium/jspi/web/IppResponseIppImpl.java:
--------------------------------------------------------------------------------
1 | package com.xinterium.jspi.web;
2 | import java.io.ByteArrayOutputStream;
3 | import java.io.IOException;
4 | import java.io.OutputStream;
5 | import java.io.UnsupportedEncodingException;
6 | import java.util.logging.Logger;
7 |
8 | import javax.print.attribute.Attribute;
9 | import javax.print.attribute.AttributeSet;
10 | import javax.print.attribute.HashAttributeSet;
11 | import javax.print.attribute.HashPrintJobAttributeSet;
12 | import javax.print.attribute.PrintJobAttributeSet;
13 |
14 | import de.lohndirekt.print.attribute.AttributeHelper;
15 | import de.lohndirekt.print.attribute.AttributeWriter;
16 | import de.lohndirekt.print.attribute.IppDelimiterTag;
17 | import de.lohndirekt.print.attribute.IppStatus;
18 | import de.lohndirekt.print.attribute.ipp.Charset;
19 | import de.lohndirekt.print.attribute.ipp.NaturalLanguage;
20 |
21 | public class IppResponseIppImpl {
22 | private final Logger log = Logger.getLogger(this.getClass().getName());
23 |
24 | private final IppStatus status;
25 |
26 | // Id wird in der Cups-API zwar Uebergeben, ist aber auch immer 1.
27 | private final int id = 1;
28 |
29 | private final PrintJobAttributeSet jobAttributes = new HashPrintJobAttributeSet();
30 |
31 | private final AttributeSet operationAttributes = new HashAttributeSet();
32 |
33 | private final AttributeSet printerAttributes = new HashAttributeSet();
34 |
35 | private static final NaturalLanguage NATURAL_LANGUAGE_DEFAULT = NaturalLanguage.EN;
36 |
37 | private static final Charset CHARSET_DEFAULT = Charset.UTF_8;
38 |
39 | public IppResponseIppImpl(IppStatus status) {
40 | super();
41 | this.status = status;
42 | operationAttributes.add(CHARSET_DEFAULT);
43 | operationAttributes.add(NATURAL_LANGUAGE_DEFAULT);
44 | }
45 |
46 | /**
47 | * @return
48 | */
49 | public IppStatus getStatus() {
50 | return status;
51 | }
52 |
53 | private byte[] ippFooter() {
54 | byte[] footer = new byte[1];
55 | footer[0] = (byte) IppDelimiterTag.END_ATTRIBUTES.getValue();
56 | return footer;
57 | }
58 |
59 | private byte[] ippHeader() {
60 | // Ipp header data according to http://www.ietf.org/rfc/rfc2910.txt
61 | ByteArrayOutputStream out = new ByteArrayOutputStream(8);
62 | // The first 2 bytes represent the IPP version number (1.1)
63 | // major version-number
64 | out.write((byte) 1);
65 | // minor version-number
66 | out.write((byte) 1);
67 | // 2 byte status id
68 | AttributeWriter.writeInt2(this.status.getStatus(), out);
69 | // 4 byte request id
70 | AttributeWriter.writeInt4(this.id, out);
71 | return out.toByteArray();
72 | }
73 |
74 | private byte[] ippAttributes() throws UnsupportedEncodingException {
75 | ByteArrayOutputStream out = new ByteArrayOutputStream();
76 | operationAttributes(out);
77 | printerAttributes(out);
78 | jobAttributes(out);
79 | byte[] body = out.toByteArray();
80 | return body;
81 | }
82 |
83 | /**
84 | * @param out
85 | * @return
86 | */
87 | private void jobAttributes(ByteArrayOutputStream out)
88 | throws UnsupportedEncodingException {
89 | if (!jobAttributes.isEmpty()) {
90 | out.write((byte) IppDelimiterTag.BEGIN_JOB_ATTRIBUTES.getValue());
91 | for (int i = 0; i < jobAttributes.toArray().length; i++) {
92 | Attribute attribute = jobAttributes.toArray()[i];
93 | AttributeWriter.attributeBytes(attribute, out);
94 | }
95 | }
96 | }
97 |
98 | /**
99 | *
100 | * @param out
101 | * @return
102 | */
103 | private void printerAttributes(ByteArrayOutputStream out)
104 | throws UnsupportedEncodingException {
105 | if (!printerAttributes.isEmpty()) {
106 | out.write((byte) IppDelimiterTag.BEGIN_PRINTER_ATTRIBUTES
107 | .getValue());
108 | Attribute[] attributes = printerAttributes.toArray();
109 | for (int i = 0; i < attributes.length; i++) {
110 | AttributeWriter.attributeBytes(attributes[i], out);
111 | }
112 | }
113 | }
114 |
115 | /**
116 | *
117 | * @param out
118 | * @return
119 | */
120 | private void operationAttributes(ByteArrayOutputStream out)
121 | throws UnsupportedEncodingException {
122 | if (!operationAttributes.isEmpty()) {
123 | out.write((byte) IppDelimiterTag.BEGIN_OPERATION_ATTRIBUTES
124 | .getValue());
125 | Attribute[] attributes = AttributeHelper
126 | .getOrderedOperationAttributeArray(operationAttributes);
127 | for (int i = 0; i < attributes.length; i++) {
128 | AttributeWriter.attributeBytes(attributes[i], out);
129 | }
130 | }
131 | }
132 |
133 | public void write(OutputStream os) throws IOException {
134 | os.write(this.ippHeader());
135 | os.write(this.ippAttributes());
136 | os.write(this.ippFooter());
137 | }
138 |
139 | public PrintJobAttributeSet getJobAttributes() {
140 | return jobAttributes;
141 | }
142 |
143 | public AttributeSet getOperationAttributes() {
144 | return operationAttributes;
145 | }
146 |
147 | public AttributeSet getPrinterAttributes() {
148 | return printerAttributes;
149 | }
150 |
151 | }
152 |
--------------------------------------------------------------------------------
/jspi-core/src/main/java/de/lohndirekt/print/IppHttpConnection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package de.lohndirekt.print;
20 |
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 | import java.net.HttpURLConnection;
24 | import java.net.URI;
25 | import java.net.URISyntaxException;
26 | import java.util.logging.Level;
27 | import java.util.logging.Logger;
28 |
29 | import org.apache.commons.httpclient.Credentials;
30 | import org.apache.commons.httpclient.HttpClient;
31 | import org.apache.commons.httpclient.UsernamePasswordCredentials;
32 | import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
33 | import org.apache.commons.httpclient.methods.PostMethod;
34 |
35 | import de.lohndirekt.print.exception.AuthenticationException;
36 |
37 |
38 | /**
39 | * simple facade / abstraction layer to "commons httpclient"
40 | *
41 | * @author sefftinge
42 | *
43 | */
44 | class IppHttpConnection implements IppConnection {
45 |
46 | private Logger log = Logger.getLogger(this.getClass().getName());
47 |
48 | private HttpClient httpConn;
49 |
50 | private PostMethod method;
51 |
52 | /**
53 | * @param uri
54 | * @param user
55 | * @param passwd
56 | * @param useStream
57 | */
58 | public IppHttpConnection(URI uri, String user, String passwd) {
59 | try {
60 | httpConn = new HttpClient();
61 | method = new PostMethod(toHttpURI(uri).toString());
62 | method.addRequestHeader("Content-type", "application/ipp");
63 | method.addRequestHeader("Accept", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2");
64 | method.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_AUTO);
65 | // authentication
66 | if (user != null && user.trim().length() > 0) {
67 | if (log.isLoggable(Level.FINER)) {
68 | log.log(Level.SEVERE, "Using username: "+user+" , passwd.length "+passwd.length());
69 | }
70 | method.setDoAuthentication(true);
71 | Credentials creds = new UsernamePasswordCredentials(user,
72 | passwd);
73 | httpConn.getState().setCredentials(null,
74 | toHttpURI(uri).getHost(), creds);
75 |
76 | }
77 |
78 | } catch (Exception e) {
79 | log.log(Level.SEVERE, e.getMessage(), e);
80 | }
81 | }
82 |
83 |
84 | /**
85 | * @return content of the response
86 | * @throws IOException
87 | */
88 | public InputStream getIppResponse() throws IOException {
89 | return method.getResponseBodyAsStream();
90 | }
91 |
92 | /**
93 | * @return the statuscode of last request
94 | * @throws IOException
95 | */
96 | public int getStatusCode() throws IOException {
97 | return method.getStatusCode();
98 | }
99 |
100 | private static URI toHttpURI(URI uri) {
101 | if (uri.getScheme().equals("ipp")) {
102 | String uriString = uri.toString().replaceFirst("ipp", "http");
103 | // TODO remove this hack!
104 | // uriString = uriString.replaceAll("(\\d{1,3}\\.){3}\\d{1,3}:\\d{1,}", "127.0.0.1:631");
105 | // endof hack
106 | try {
107 | uri = new URI(uriString);
108 | } catch (URISyntaxException e) {
109 | throw new RuntimeException("toHttpURI buggy? : uri was " + uri);
110 | }
111 | }
112 | return uri;
113 | }
114 |
115 | /**
116 | * @param stream
117 | */
118 | public void setIppRequest(InputStream stream) {
119 | method.setRequestBody(stream);
120 | }
121 |
122 | public boolean execute() throws IOException {
123 | if (this.method.validate()) {
124 | httpConn.executeMethod(method);
125 | if (this.getStatusCode()==HttpURLConnection.HTTP_UNAUTHORIZED) {
126 | throw new AuthenticationException(method.getStatusText());
127 | }
128 | return true;
129 | } else {
130 | return false;
131 | }
132 | }
133 |
134 | }
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/examples/MultiDocExample.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.examples;
20 | import java.io.File;
21 | import java.io.FileInputStream;
22 | import java.io.FileNotFoundException;
23 | import java.io.InputStream;
24 | import java.net.MalformedURLException;
25 | import java.net.URISyntaxException;
26 |
27 | import javax.print.Doc;
28 | import javax.print.DocFlavor;
29 | import javax.print.MultiDocPrintJob;
30 | import javax.print.MultiDocPrintService;
31 | import javax.print.PrintException;
32 | import javax.print.SimpleDoc;
33 | import javax.print.attribute.HashDocAttributeSet;
34 | import javax.print.attribute.HashPrintRequestAttributeSet;
35 | import javax.print.attribute.PrintRequestAttributeSet;
36 | import javax.print.attribute.standard.Copies;
37 | import javax.print.attribute.standard.Media;
38 | import javax.print.attribute.standard.MediaTray;
39 | import javax.print.attribute.standard.Sides;
40 |
41 | import de.lohndirekt.print.IppPrintServiceLookup;
42 | import de.lohndirekt.print.SimpleMultiDoc;
43 |
44 | public class MultiDocExample {
45 |
46 | public static void main(String[] args)
47 | throws URISyntaxException, FileNotFoundException, PrintException, MalformedURLException {
48 | // setting cups properties
49 | System.getProperties().setProperty(IppPrintServiceLookup.URI_KEY, Messages.getString("cups.uri")); //$NON-NLS-1$
50 | System.getProperties().setProperty(IppPrintServiceLookup.USERNAME_KEY, Messages.getString("cups.username")); //$NON-NLS-1$
51 | System.getProperties().setProperty(IppPrintServiceLookup.PASSWORD_KEY, Messages.getString("cups.password")); //$NON-NLS-1$
52 |
53 | // get the PrintServices
54 | MultiDocPrintService[] services = new IppPrintServiceLookup().getMultiDocPrintServices(null, null);
55 |
56 | // get the first Printer
57 | if (services.length > 0) {
58 | MultiDocPrintService service = services[0];
59 | System.out.println("Printing on: " + service.getName());
60 | // create a job
61 | MultiDocPrintJob job = service.createMultiDocPrintJob();
62 |
63 | // set the job attributes
64 | PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
65 | // we just want one copy
66 | Copies copies = new Copies(1);
67 | attributes.add(copies);
68 | // we want duplex printing
69 | Sides sides = Sides.DUPLEX;
70 | attributes.add(sides);
71 | // print it on the main media tray
72 | Media media = MediaTray.MAIN;
73 | // If you have special Mediatrays (like most printers)
74 | // you can use the class LdMediaTray and give a String to the constructor like
75 | // new LdMediaTray("Optional2");
76 | attributes.add(media);
77 |
78 | // Now create some documents
79 | File testFile = new File(Messages.getString("pdfdocument.1"));
80 | InputStream stream = new FileInputStream(testFile);
81 | Doc doc = new SimpleDoc(stream, DocFlavor.INPUT_STREAM.PDF, new HashDocAttributeSet());
82 | File testFile2 = new File(Messages.getString("pdfdocument.2"));
83 | InputStream stream2 = new FileInputStream(testFile2);
84 | Doc doc2 = new SimpleDoc(stream2, DocFlavor.INPUT_STREAM.PDF, new HashDocAttributeSet());
85 | // now we need a MultiDoc
86 | SimpleMultiDoc multiDoc = SimpleMultiDoc.create(doc);
87 | // finally the print action
88 | try {
89 | // we are setting the doc and the job attributes
90 | job.print(multiDoc, attributes);
91 |
92 | // now add several docs to your mutliDoc
93 | // cups waits for the document with the attribute last-document = true
94 | // wich you can set like this:
95 | boolean lastDocument = true;
96 | multiDoc.setNext(doc2, lastDocument);
97 |
98 | System.out.println("printing successfull...");
99 | } catch (PrintException e) {
100 | e.printStackTrace();
101 | }
102 |
103 | } else {
104 | System.out.println("no Services found!");
105 | }
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/test/IppPrintServiceTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.test;
20 |
21 | import de.lohndirekt.print.IppPrintServiceLookup;
22 | import de.lohndirekt.print.IppRequestFactory;
23 | import de.lohndirekt.print.attribute.IppAttributeName;
24 | import de.lohndirekt.print.IppRequestTestImpl;
25 | import junit.framework.TestCase;
26 |
27 | import javax.print.PrintService;
28 | import javax.print.attribute.Attribute;
29 | import java.net.URI;
30 | import java.util.Arrays;
31 | import java.util.List;
32 | import java.util.logging.Logger;
33 |
34 | /**
35 | * @author bpusch
36 | *
37 | */
38 | public class IppPrintServiceTest extends TestCase {
39 |
40 | PrintService service;
41 | Logger log;
42 |
43 | /**
44 | * Constructor for IppPrintServiceTest.
45 | * @param arg0
46 | */
47 | public IppPrintServiceTest(String arg0) {
48 | super(arg0);
49 | }
50 |
51 | /*
52 | * @see TestCase#setUp()
53 | */
54 | protected void setUp() throws Exception {
55 | super.setUp();
56 | System.setProperty(IppRequestFactory.IPP_REQUEST_IMPL_KEY, IppRequestTestImpl.class.getName());
57 | IppPrintServiceLookup lookup = new IppPrintServiceLookup(new URI("http://127.0.0.1"), "", "");
58 | PrintService[] services = lookup.getPrintServices();
59 | this.service = services[0];
60 | this.log = Logger.getLogger(this.getName());
61 | }
62 |
63 | public void testGetSupportedAttributeCategories() {
64 | Class[] categories = this.service.getSupportedAttributeCategories();
65 | assertNotNull(categories);
66 | List cats = Arrays.asList(categories);
67 | assertTrue(cats.contains(IppAttributeName.JOB_PRIORIY.getCategory()));
68 | assertTrue(cats.contains(IppAttributeName.JOB_HOLD_UNTIL.getCategory()));
69 | assertTrue(cats.contains(IppAttributeName.JOB_SHEETS.getCategory()));
70 | assertTrue(cats.contains(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING.getCategory()));
71 | assertTrue(cats.contains(IppAttributeName.COPIES.getCategory()));
72 | assertTrue(cats.contains(IppAttributeName.FINISHINGS.getCategory()));
73 | assertTrue(cats.contains(IppAttributeName.SIDES.getCategory()));
74 | assertTrue(cats.contains(IppAttributeName.NUMBER_UP.getCategory()));
75 | assertTrue(cats.contains(IppAttributeName.ORIENTATION_REQUESTED.getCategory()));
76 | assertTrue(cats.contains(IppAttributeName.MEDIA.getCategory()));
77 | assertTrue(cats.contains(IppAttributeName.COMPRESSION.getCategory()));
78 | assertTrue(cats.contains(IppAttributeName.JOB_K_OCTETS.getCategory()));
79 | assertTrue(cats.contains(IppAttributeName.JOB_IMPRESSIONS.getCategory()));
80 | assertTrue(cats.contains(IppAttributeName.JOB_MEDIA_SHEETS.getCategory()));
81 | }
82 |
83 | public void testIsAttributeCategorySupported() {
84 | Class category = IppAttributeName.JOB_SHEETS.getCategory();
85 | boolean supported = this.service.isAttributeCategorySupported(category);
86 | assertEquals(Arrays.asList(this.service.getSupportedAttributeCategories()).contains(category), supported);
87 |
88 | }
89 |
90 | public void testGetSupportedAttributeValues() {
91 | Class category = IppAttributeName.MEDIA.getCategory();
92 | Attribute[] attrs = (Attribute[]) this.service.getSupportedAttributeValues(category, null, null);
93 | assertEquals("Should be 2 media-supported attributes", 2, attrs.length);
94 | for (int j = 0; j < attrs.length; j++) {
95 | Attribute attribute = attrs[j];
96 | assertEquals(IppAttributeName.MEDIA_SUPPORTED.getCategory(), attribute.getCategory());
97 | }
98 | category = IppAttributeName.COMPRESSION.getCategory();
99 | attrs = (Attribute[]) this.service.getSupportedAttributeValues(category, null, null);
100 | for (int j = 0; j < attrs.length; j++) {
101 | Attribute attribute = attrs[j];
102 | assertEquals(IppAttributeName.COMPRESSION_SUPORTED.getCategory(), attribute.getCategory());
103 | }
104 | category = IppAttributeName.JOB_PRIORIY.getCategory();
105 | attrs = (Attribute[]) this.service.getSupportedAttributeValues(category, null, null);
106 | assertEquals("Should be 1 job-priority-supported attribute", 1, attrs.length);
107 | for (int j = 0; j < attrs.length; j++) {
108 | Attribute attribute = attrs[j];
109 | assertEquals(IppAttributeName.JOB_PRIORIY_SUPPORTED.getCategory(), attribute.getCategory());
110 | }
111 | category = IppAttributeName.SIDES.getCategory();
112 | attrs = (Attribute[]) this.service.getSupportedAttributeValues(category, null, null);
113 | assertEquals("Should be 2 sides-supported attributes", 2, attrs.length);
114 | for (int j = 0; j < attrs.length; j++) {
115 | Attribute attribute = attrs[j];
116 | assertEquals(IppAttributeName.SIDES_SUPPORTED.getCategory(), attribute.getCategory());
117 | }
118 |
119 | }
120 |
121 | }
--------------------------------------------------------------------------------
/jspi-core/src/test/java/com/xinterium/jspi/examples/SimpleDocExample.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2003 lohndirekt.de
3 | *
4 | * This library is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU Lesser General Public
6 | * License as published by the Free Software Foundation; either
7 | * version 2.1 of the License, or (at your option) any later version.
8 | *
9 | * This library is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public
15 | * License along with this library; if not, write to the Free Software
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 | *
18 | */
19 | package com.xinterium.jspi.examples;
20 |
21 | import java.io.File;
22 | import java.io.FileInputStream;
23 | import java.io.IOException;
24 | import java.io.InputStream;
25 | import java.net.URISyntaxException;
26 | import java.util.Locale;
27 |
28 | import javax.print.CancelablePrintJob;
29 | import javax.print.Doc;
30 | import javax.print.DocFlavor;
31 | import javax.print.PrintException;
32 | import javax.print.PrintService;
33 | import javax.print.SimpleDoc;
34 | import javax.print.attribute.HashDocAttributeSet;
35 | import javax.print.attribute.HashPrintRequestAttributeSet;
36 | import javax.print.attribute.PrintRequestAttributeSet;
37 | import javax.print.attribute.standard.Copies;
38 | import javax.print.attribute.standard.RequestingUserName;
39 | import javax.print.attribute.standard.Sides;
40 |
41 | import de.lohndirekt.print.IppPrintServiceLookup;
42 | import de.lohndirekt.print.attribute.auth.RequestingUserPassword;
43 |
44 | /**
45 | * @author sefftinge
46 | *
47 | *
48 | */
49 | public class SimpleDocExample {
50 |
51 | /**
52 | * @param args
53 | * @throws URISyntaxException
54 | * @throws PrintException
55 | * @throws IOException
56 | */
57 | public static void main(String[] args) throws URISyntaxException,
58 | PrintException, IOException {
59 |
60 | // setting cups properties
61 | System.getProperties().setProperty(IppPrintServiceLookup.URI_KEY,
62 | Messages.getString("cups.uri")); //$NON-NLS-1$
63 | System.getProperties().setProperty(IppPrintServiceLookup.USERNAME_KEY,
64 | Messages.getString("cups.username")); //$NON-NLS-1$
65 | System.getProperties().setProperty(IppPrintServiceLookup.PASSWORD_KEY,
66 | Messages.getString("cups.password")); //$NON-NLS-1$
67 |
68 | // get the PrintServices
69 | PrintService[] services = new IppPrintServiceLookup().getPrintServices();
70 |
71 | // get the first Printer
72 | if (services.length > 0) {
73 | PrintService service = null;
74 | System.out.println("Please choose a print service:");
75 | for (int i = 0; i < services.length; i++) {
76 | PrintService service2 = services[i];
77 | System.out.println("[" + i + "] : " + service2.getName());
78 | }
79 | // let the user choose a service
80 | while (true) {
81 | int serviceToUse = Integer.valueOf(readStdIn()).intValue();
82 | if (serviceToUse < 0 || serviceToUse >= services.length) {
83 | System.out.println("Bitte eine Zahl zwischen 0 und "
84 | + (services.length - 1) + " eingeben.");
85 | } else {
86 | service = services[serviceToUse];
87 | break;
88 | }
89 | }
90 |
91 | // ask for username
92 | System.out.print("Username : ");
93 | String username = readStdIn().trim();
94 | String password = null;
95 | if (username != null && username.trim().length() > 0) {
96 | System.out.print("Password : ");
97 | password = readStdIn().trim();
98 | }
99 |
100 | System.out.println("Printing on: " + service.getName());
101 | // create a job
102 | CancelablePrintJob job = (CancelablePrintJob) service
103 | .createPrintJob();
104 |
105 | // set the job attributes
106 | PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
107 |
108 | if (username != null && username.trim().length() > 0) {
109 | RequestingUserName usernameAttr = new RequestingUserName(
110 | username, Locale.GERMANY);
111 | RequestingUserPassword userpassAttr = new RequestingUserPassword(
112 | password, Locale.GERMANY);
113 | attributes.add(usernameAttr);
114 | attributes.add(userpassAttr);
115 | }
116 | // we just want one copy
117 | Copies copies = new Copies(1);
118 | attributes.add(copies);
119 | // we want duplex printing
120 | Sides sides = Sides.DUPLEX;
121 | attributes.add(sides);
122 | // print it on the main media tray
123 | // Media media = MediaTray.MAIN;
124 | // If you have special Mediatrays (like most printers)
125 | // you can use the class LdMediaTray and give a String to the
126 | // constructor like
127 | // new LdMediaTray("Optional2");
128 | // attributes.add(media);
129 |
130 | // Now create a document
131 | File testFile = new File(Messages.getString("pdfdocument.1"));
132 | InputStream stream = new FileInputStream(testFile);
133 | Doc doc = new SimpleDoc(stream, DocFlavor.INPUT_STREAM.PDF,
134 | new HashDocAttributeSet());
135 |
136 | // finally the print action
137 | try {
138 | // we are setting the doc and the job attributes
139 | job.print(doc, attributes);
140 | System.out.println("printing successfull...");
141 | } catch (PrintException e) {
142 | e.printStackTrace();
143 | }
144 |
145 | } else {
146 | System.out.println("no Services found!");
147 | }
148 | }
149 |
150 | /**
151 | * @return
152 | */
153 | private static String readStdIn() {
154 | StringBuilder sb = new StringBuilder();
155 | int ch;
156 | try {
157 | while ((ch = System.in.read()) != 10) {
158 | sb.append((char) ch);
159 | }
160 | } catch (IOException e) {
161 | e.printStackTrace();
162 | }
163 | return sb.toString();
164 | }
165 | }
--------------------------------------------------------------------------------