Skip to content

Commit

Permalink
Policy extended to include additional elements. Groovy compiler versi…
Browse files Browse the repository at this point in the history
…on changed to 2.0.
  • Loading branch information
keshavarzi committed Oct 4, 2013
1 parent 4a96e51 commit 83349d5
Show file tree
Hide file tree
Showing 35 changed files with 72 additions and 268 deletions.
2 changes: 1 addition & 1 deletion core/.settings/org.eclipse.jdt.groovy.core.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
eclipse.preferences.version=1
groovy.compiler.level=21
groovy.compiler.level=20
groovy.script.filters=scripts/**/*.groovy,y,src/main/resources/**/*.groovy,y,src/test/resources/**/*.groovy,y
14 changes: 0 additions & 14 deletions core/src/main/groovy/com/predic8/policy/AlgorithmSuite.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class AlgorithmSuite extends PolicyOperator{

/**
* ELEMENTNAME will be set at runtime. Depending on the used version,
* it should be the one from the XML document cause it will be used
* to find the end tag of the XML element.
*/
QName ELEMENTNAME

protected parseChildren(token, child, ctx){
super.parseChildren(token, child, ctx)
}

}

9 changes: 0 additions & 9 deletions core/src/main/groovy/com/predic8/policy/All.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class All extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

9 changes: 0 additions & 9 deletions core/src/main/groovy/com/predic8/policy/Basic128.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class Basic128 extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

15 changes: 0 additions & 15 deletions core/src/main/groovy/com/predic8/policy/Body.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class Body extends PolicyOperator{

/**
* ELEMENTNAME will be set at runtime. Depending on the used version,
* it should be the one from the XML document cause it will be used
* to find the end tag of the XML element.
*/
QName ELEMENTNAME

protected parseChildren(token, child, ctx){
super.parseChildren(token, child, ctx)
}

}

9 changes: 0 additions & 9 deletions core/src/main/groovy/com/predic8/policy/EncryptedParts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class EncryptedParts extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

15 changes: 0 additions & 15 deletions core/src/main/groovy/com/predic8/policy/ExactlyOne.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName

import com.predic8.soamodel.*

class ExactlyOne extends PolicyOperator{

/**
* ELEMENTNAME will be set at runtime. Depending on the used version,
* it should be the one from the XML document cause it will be used
* to find the end tag of the XML element.
*/
public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

16 changes: 0 additions & 16 deletions core/src/main/groovy/com/predic8/policy/Header.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,13 @@

package com.predic8.policy

import javax.xml.namespace.QName

import com.predic8.policy.creator.PolicyCreator;
import com.predic8.soamodel.*

class Header extends PolicyOperator{

/**
* ELEMENTNAME will be set at runtime. Depending on the used version,
* it should be the one from the XML document cause it will be used
* to find the end tag of the XML element.
*/
QName ELEMENTNAME
String namespace

protected parseAttributes( token, ctx) {
name = token.getAttributeValue( null , 'Name')
namespace = token.getAttributeValue( null , 'Namespace')
}

void create(PolicyCreator creator, CreatorContext ctx){
creator.createHeader(this, ctx)
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class IncludeTimestamp extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

9 changes: 0 additions & 9 deletions core/src/main/groovy/com/predic8/policy/Layout.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class Layout extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class MustSupportRefEncryptedKey extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class MustSupportRefIssuerSerial extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class MustSupportRefKeyIdentifier extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class MustSupportRefThumbprint extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class OnlySignEntireHeadersAndBody extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

18 changes: 10 additions & 8 deletions core/src/main/groovy/com/predic8/policy/Policy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@

package com.predic8.policy

import groovy.xml.MarkupBuilder

import javax.xml.namespace.QName

import com.predic8.policy.creator.PolicyCreator;
import com.predic8.policy.creator.PolicyCreator
import com.predic8.policy.creator.PolicyCreatorContext
import com.predic8.soamodel.*

class Policy extends PolicyOperator{

/**
* ELEMENTNAME will be set at runtime. Depending on the used version,
* it should be the one from the XML document cause it will be used
* to find the end tag of the XML element.
*/
QName ELEMENTNAME

String id

protected def parseAttributes( token, AbstractParserContext ctx) {
Expand All @@ -41,6 +37,12 @@ class Policy extends PolicyOperator{
allPolicyItems.ELEMENTNAME.localPart
}

public String getAsString(){
StringWriter strWriter = new StringWriter()
new PolicyCreator(builder: new MarkupBuilder(strWriter)).createPolicy(this, new PolicyCreatorContext())
strWriter.toString()
}

void create(PolicyCreator creator, CreatorContext ctx){
creator.createPolicy(this, ctx)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class PolicyItemUtility {
case 'WssUsernameToken10' : return new WssUsernameToken10(ELEMENTNAME: qname) ; break
case 'EncryptedParts' : return new EncryptedParts(ELEMENTNAME: qname) ; break
case 'SignedParts' : return new SignedParts(ELEMENTNAME: qname) ; break
case 'TransportBinding' : return new TransportBinding(ELEMENTNAME: qname) ; break
case 'TransportToken' : return new TransportToken(ELEMENTNAME: qname) ; break
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/groovy/com/predic8/policy/PolicyOperator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ abstract class PolicyOperator extends XMLElement {

static final String NAMESPACE = Consts.WSP15_NS

/**
* ELEMENTNAME will be set at runtime. Depending on the used version,
* it should be the one from the XML document cause it will be used
* to find the end tag of the XML element.
*/
JQName ELEMENTNAME

String name
WSDLElement wsdlElement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class ProtectionToken extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

9 changes: 0 additions & 9 deletions core/src/main/groovy/com/predic8/policy/SignedParts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class SignedParts extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@

package com.predic8.policy

import javax.xml.namespace.QName
import com.predic8.soamodel.*

class SignedSupportingTokens extends PolicyOperator{

public QName ELEMENTNAME

QName getElementName() {
ELEMENTNAME
}

}

Loading

0 comments on commit 83349d5

Please sign in to comment.