1 19 20 package org.netbeans.modules.websvc.wsitmodelext.security; 21 22 import org.netbeans.modules.websvc.wsitmodelext.security.impl.*; 23 import org.netbeans.modules.websvc.wsitmodelext.security.parameters.impl.*; 24 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 25 import org.netbeans.modules.xml.wsdl.model.spi.ElementFactory; 26 import org.w3c.dom.Element ; 27 28 import javax.xml.namespace.QName ; 29 import java.util.Collections ; 30 import java.util.Set ; 31 32 public class SecurityPolicyFactories { 33 34 public static class Wss11Factory extends ElementFactory { 35 @Override 36 public Set <QName > getElementQNames() { 37 return Collections.singleton(SecurityPolicyQName.WSS11.getQName()); 38 } 39 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 40 return type.cast(new Wss11Impl(context.getModel())); 41 } 42 @Override 43 public WSDLComponent create(WSDLComponent context, Element element) { 44 return new Wss11Impl(context.getModel(), element); 45 } 46 } 47 48 public static class Wss10Factory extends ElementFactory { 49 @Override 50 public Set <QName > getElementQNames() { 51 return Collections.singleton(SecurityPolicyQName.WSS10.getQName()); 52 } 53 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 54 return type.cast(new Wss10Impl(context.getModel())); 55 } 56 @Override 57 public WSDLComponent create(WSDLComponent context, Element element) { 58 return new Wss10Impl(context.getModel(), element); 59 } 60 } 61 62 public static class MustSupportRefEmbeddedTokenFactory extends ElementFactory { 63 @Override 64 public Set <QName > getElementQNames() { 65 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTREFEMBEDDEDTOKEN.getQName()); 66 } 67 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 68 return type.cast(new MustSupportRefEmbeddedTokenImpl(context.getModel())); 69 } 70 @Override 71 public WSDLComponent create(WSDLComponent context, Element element) { 72 return new MustSupportRefEmbeddedTokenImpl(context.getModel(), element); 73 } 74 } 75 76 public static class MustSupportRefEncryptedKeyFactory extends ElementFactory { 77 @Override 78 public Set <QName > getElementQNames() { 79 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTREFENCRYPTEDKEY.getQName()); 80 } 81 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 82 return type.cast(new MustSupportRefEncryptedKeyImpl(context.getModel())); 83 } 84 @Override 85 public WSDLComponent create(WSDLComponent context, Element element) { 86 return new MustSupportRefEncryptedKeyImpl(context.getModel(), element); 87 } 88 } 89 90 public static class MustSupportRefExternalURIFactory extends ElementFactory { 91 @Override 92 public Set <QName > getElementQNames() { 93 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTREFEXTERNALURI.getQName()); 94 } 95 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 96 return type.cast(new MustSupportRefExternalURIImpl(context.getModel())); 97 } 98 @Override 99 public WSDLComponent create(WSDLComponent context, Element element) { 100 return new MustSupportRefExternalURIImpl(context.getModel(), element); 101 } 102 } 103 104 public static class MustSupportRefIssuerSerialFactory extends ElementFactory { 105 @Override 106 public Set <QName > getElementQNames() { 107 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTREFISSUERSERIAL.getQName()); 108 } 109 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 110 return type.cast(new MustSupportRefIssuerSerialImpl(context.getModel())); 111 } 112 @Override 113 public WSDLComponent create(WSDLComponent context, Element element) { 114 return new MustSupportRefIssuerSerialImpl(context.getModel(), element); 115 } 116 } 117 118 public static class MustSupportRefKeyIdentifierFactory extends ElementFactory { 119 @Override 120 public Set <QName > getElementQNames() { 121 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTREFKEYIDENTIFIER.getQName()); 122 } 123 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 124 return type.cast(new MustSupportRefKeyIdentifierImpl(context.getModel())); 125 } 126 @Override 127 public WSDLComponent create(WSDLComponent context, Element element) { 128 return new MustSupportRefKeyIdentifierImpl(context.getModel(), element); 129 } 130 } 131 132 public static class MustSupportRefThumbprintFactory extends ElementFactory { 133 @Override 134 public Set <QName > getElementQNames() { 135 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTREFTHUMBPRINT.getQName()); 136 } 137 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 138 return type.cast(new MustSupportRefThumbprintImpl(context.getModel())); 139 } 140 @Override 141 public WSDLComponent create(WSDLComponent context, Element element) { 142 return new MustSupportRefThumbprintImpl(context.getModel(), element); 143 } 144 } 145 146 public static class RequireSignatureConfirmationFactory extends ElementFactory { 147 @Override 148 public Set <QName > getElementQNames() { 149 return Collections.singleton(SecurityPolicyQName.REQUIRESIGNATURECONFIRMATION.getQName()); 150 } 151 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 152 return type.cast(new RequireSignatureConfirmationImpl(context.getModel())); 153 } 154 @Override 155 public WSDLComponent create(WSDLComponent context, Element element) { 156 return new RequireSignatureConfirmationImpl(context.getModel(), element); 157 } 158 } 159 160 public static class RequestSecurityTokenTemplateFactory extends ElementFactory { 161 @Override 162 public Set <QName > getElementQNames() { 163 return Collections.singleton(SecurityPolicyQName.REQUESTSECURITYTOKENTEMPLATE.getQName()); 164 } 165 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 166 return type.cast(new RequestSecurityTokenTemplateImpl(context.getModel())); 167 } 168 @Override 169 public WSDLComponent create(WSDLComponent context, Element element) { 170 return new RequestSecurityTokenTemplateImpl(context.getModel(), element); 171 } 172 } 173 174 public static class Trust10Factory extends ElementFactory { 175 @Override 176 public Set <QName > getElementQNames() { 177 return Collections.singleton(SecurityPolicyQName.TRUST10.getQName()); 178 } 179 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 180 return type.cast(new Trust10Impl(context.getModel())); 181 } 182 @Override 183 public WSDLComponent create(WSDLComponent context, Element element) { 184 return new Trust10Impl(context.getModel(), element); 185 } 186 } 187 188 public static class RequireServerEntropyFactory extends ElementFactory { 189 @Override 190 public Set <QName > getElementQNames() { 191 return Collections.singleton(SecurityPolicyQName.REQUIRESERVERENTROPY.getQName()); 192 } 193 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 194 return type.cast(new RequireServerEntropyImpl(context.getModel())); 195 } 196 @Override 197 public WSDLComponent create(WSDLComponent context, Element element) { 198 return new RequireServerEntropyImpl(context.getModel(), element); 199 } 200 } 201 202 public static class RequireClientEntropyFactory extends ElementFactory { 203 @Override 204 public Set <QName > getElementQNames() { 205 return Collections.singleton(SecurityPolicyQName.REQUIRECLIENTENTROPY.getQName()); 206 } 207 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 208 return type.cast(new RequireClientEntropyImpl(context.getModel())); 209 } 210 @Override 211 public WSDLComponent create(WSDLComponent context, Element element) { 212 return new RequireClientEntropyImpl(context.getModel(), element); 213 } 214 } 215 216 public static class MustSupportIssuedTokensFactory extends ElementFactory { 217 @Override 218 public Set <QName > getElementQNames() { 219 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTISSUEDTOKENS.getQName()); 220 } 221 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 222 return type.cast(new MustSupportIssuedTokensImpl(context.getModel())); 223 } 224 @Override 225 public WSDLComponent create(WSDLComponent context, Element element) { 226 return new MustSupportIssuedTokensImpl(context.getModel(), element); 227 } 228 } 229 230 public static class MustSupportClientChallengeFactory extends ElementFactory { 231 @Override 232 public Set <QName > getElementQNames() { 233 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTCLIENTCHALLENGE.getQName()); 234 } 235 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 236 return type.cast(new MustSupportClientChallengeImpl(context.getModel())); 237 } 238 @Override 239 public WSDLComponent create(WSDLComponent context, Element element) { 240 return new MustSupportClientChallengeImpl(context.getModel(), element); 241 } 242 } 243 244 public static class MustSupportServerChallengeFactory extends ElementFactory { 245 @Override 246 public Set <QName > getElementQNames() { 247 return Collections.singleton(SecurityPolicyQName.MUSTSUPPORTSERVERCHALLENGE.getQName()); 248 } 249 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 250 return type.cast(new MustSupportServerChallengeImpl(context.getModel())); 251 } 252 @Override 253 public WSDLComponent create(WSDLComponent context, Element element) { 254 return new MustSupportServerChallengeImpl(context.getModel(), element); 255 } 256 } 257 258 public static class IncludeTimestampFactory extends ElementFactory { 259 @Override 260 public Set <QName > getElementQNames() { 261 return Collections.singleton(SecurityPolicyQName.INCLUDETIMESTAMP.getQName()); 262 } 263 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 264 return type.cast(new IncludeTimestampImpl(context.getModel())); 265 } 266 @Override 267 public WSDLComponent create(WSDLComponent context, Element element) { 268 return new IncludeTimestampImpl(context.getModel(), element); 269 } 270 } 271 272 public static class OnlySignEntireHeadersAndBodyFactory extends ElementFactory { 273 @Override 274 public Set <QName > getElementQNames() { 275 return Collections.singleton(SecurityPolicyQName.ONLYSIGNENTIREHEADERSANDBODY.getQName()); 276 } 277 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 278 return type.cast(new OnlySignEntireHeadersAndBodyImpl(context.getModel())); 279 } 280 @Override 281 public WSDLComponent create(WSDLComponent context, Element element) { 282 return new OnlySignEntireHeadersAndBodyImpl(context.getModel(), element); 283 } 284 } 285 286 public static class EncryptSignatureFactory extends ElementFactory { 287 @Override 288 public Set <QName > getElementQNames() { 289 return Collections.singleton(SecurityPolicyQName.ENCRYPTSIGNATURE.getQName()); 290 } 291 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 292 return type.cast(new EncryptSignatureImpl(context.getModel())); 293 } 294 @Override 295 public WSDLComponent create(WSDLComponent context, Element element) { 296 return new EncryptSignatureImpl(context.getModel(), element); 297 } 298 } 299 300 public static class EncryptBeforeSigningFactory extends ElementFactory { 301 @Override 302 public Set <QName > getElementQNames() { 303 return Collections.singleton(SecurityPolicyQName.ENCRYPTBEFORESIGNING.getQName()); 304 } 305 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 306 return type.cast(new EncryptBeforeSigningImpl(context.getModel())); 307 } 308 @Override 309 public WSDLComponent create(WSDLComponent context, Element element) { 310 return new EncryptBeforeSigningImpl(context.getModel(), element); 311 } 312 } 313 314 public static class SignedElementsFactory extends ElementFactory { 315 @Override 316 public Set <QName > getElementQNames() { 317 return Collections.singleton(SecurityPolicyQName.SIGNEDELEMENTS.getQName()); 318 } 319 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 320 return type.cast(new SignedElementsImpl(context.getModel())); 321 } 322 @Override 323 public WSDLComponent create(WSDLComponent context, Element element) { 324 return new SignedElementsImpl(context.getModel(), element); 325 } 326 } 327 328 public static class SignedPartsFactory extends ElementFactory { 329 @Override 330 public Set <QName > getElementQNames() { 331 return Collections.singleton(SecurityPolicyQName.SIGNEDPARTS.getQName()); 332 } 333 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 334 return type.cast(new SignedPartsImpl(context.getModel())); 335 } 336 @Override 337 public WSDLComponent create(WSDLComponent context, Element element) { 338 return new SignedPartsImpl(context.getModel(), element); 339 } 340 } 341 342 public static class EncryptedElementsFactory extends ElementFactory { 343 @Override 344 public Set <QName > getElementQNames() { 345 return Collections.singleton(SecurityPolicyQName.ENCRYPTEDELEMENTS.getQName()); 346 } 347 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 348 return type.cast(new EncryptedElementsImpl(context.getModel())); 349 } 350 @Override 351 public WSDLComponent create(WSDLComponent context, Element element) { 352 return new EncryptedElementsImpl(context.getModel(), element); 353 } 354 } 355 356 public static class EncryptedPartsFactory extends ElementFactory { 357 @Override 358 public Set <QName > getElementQNames() { 359 return Collections.singleton(SecurityPolicyQName.ENCRYPTEDPARTS.getQName()); 360 } 361 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 362 return type.cast(new EncryptedPartsImpl(context.getModel())); 363 } 364 @Override 365 public WSDLComponent create(WSDLComponent context, Element element) { 366 return new EncryptedPartsImpl(context.getModel(), element); 367 } 368 } 369 370 public static class HeaderFactory extends ElementFactory { 371 @Override 372 public Set <QName > getElementQNames() { 373 return Collections.singleton(SecurityPolicyQName.HEADER.getQName()); 374 } 375 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 376 return type.cast(new HeaderImpl(context.getModel())); 377 } 378 @Override 379 public WSDLComponent create(WSDLComponent context, Element element) { 380 return new HeaderImpl(context.getModel(), element); 381 } 382 } 383 384 public static class BodyFactory extends ElementFactory { 385 @Override 386 public Set <QName > getElementQNames() { 387 return Collections.singleton(SecurityPolicyQName.BODY.getQName()); 388 } 389 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 390 return type.cast(new BodyImpl(context.getModel())); 391 } 392 @Override 393 public WSDLComponent create(WSDLComponent context, Element element) { 394 return new BodyImpl(context.getModel(), element); 395 } 396 } 397 398 public static class XPathFactory extends ElementFactory { 399 @Override 400 public Set <QName > getElementQNames() { 401 return Collections.singleton(SecurityPolicyQName.XPATH.getQName()); 402 } 403 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 404 return type.cast(new XPathImpl(context.getModel())); 405 } 406 @Override 407 public WSDLComponent create(WSDLComponent context, Element element) { 408 return new XPathImpl(context.getModel(), element); 409 } 410 } 411 412 public static class TransportBindingFactory extends ElementFactory { 413 @Override 414 public Set <QName > getElementQNames() { 415 return Collections.singleton(SecurityPolicyQName.TRANSPORTBINDING.getQName()); 416 } 417 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 418 return type.cast(new TransportBindingImpl(context.getModel())); 419 } 420 @Override 421 public WSDLComponent create(WSDLComponent context, Element element) { 422 return new TransportBindingImpl(context.getModel(), element); 423 } 424 } 425 426 public static class SymmetricBindingFactory extends ElementFactory { 427 @Override 428 public Set <QName > getElementQNames() { 429 return Collections.singleton(SecurityPolicyQName.SYMMETRICBINDING.getQName()); 430 } 431 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 432 return type.cast(new SymmetricBindingImpl(context.getModel())); 433 } 434 @Override 435 public WSDLComponent create(WSDLComponent context, Element element) { 436 return new SymmetricBindingImpl(context.getModel(), element); 437 } 438 } 439 440 public static class AsymmetricBindingFactory extends ElementFactory { 441 @Override 442 public Set <QName > getElementQNames() { 443 return Collections.singleton(SecurityPolicyQName.ASYMMETRICBINDING.getQName()); 444 } 445 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 446 return type.cast(new AsymmetricBindingImpl(context.getModel())); 447 } 448 @Override 449 public WSDLComponent create(WSDLComponent context, Element element) { 450 return new AsymmetricBindingImpl(context.getModel(), element); 451 } 452 } 453 454 public static class LayoutFactory extends ElementFactory { 455 @Override 456 public Set <QName > getElementQNames() { 457 return Collections.singleton(SecurityPolicyQName.LAYOUT.getQName()); 458 } 459 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 460 return type.cast(new LayoutImpl(context.getModel())); 461 } 462 @Override 463 public WSDLComponent create(WSDLComponent context, Element element) { 464 return new LayoutImpl(context.getModel(), element); 465 } 466 } 467 468 public static class StrictFactory extends ElementFactory { 469 @Override 470 public Set <QName > getElementQNames() { 471 return Collections.singleton(SecurityPolicyQName.STRICT.getQName()); 472 } 473 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 474 return type.cast(new StrictImpl(context.getModel())); 475 } 476 @Override 477 public WSDLComponent create(WSDLComponent context, Element element) { 478 return new StrictImpl(context.getModel(), element); 479 } 480 } 481 482 public static class LaxFactory extends ElementFactory { 483 @Override 484 public Set <QName > getElementQNames() { 485 return Collections.singleton(SecurityPolicyQName.LAX.getQName()); 486 } 487 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 488 return type.cast(new LaxImpl(context.getModel())); 489 } 490 @Override 491 public WSDLComponent create(WSDLComponent context, Element element) { 492 return new LaxImpl(context.getModel(), element); 493 } 494 } 495 496 public static class LaxTsFirstFactory extends ElementFactory { 497 @Override 498 public Set <QName > getElementQNames() { 499 return Collections.singleton(SecurityPolicyQName.LAXTSFIRST.getQName()); 500 } 501 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 502 return type.cast(new LaxTsFirstImpl(context.getModel())); 503 } 504 @Override 505 public WSDLComponent create(WSDLComponent context, Element element) { 506 return new LaxTsFirstImpl(context.getModel(), element); 507 } 508 } 509 510 public static class LaxTsLastFactory extends ElementFactory { 511 @Override 512 public Set <QName > getElementQNames() { 513 return Collections.singleton(SecurityPolicyQName.LAXTSLAST.getQName()); 514 } 515 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 516 return type.cast(new LaxTsLastImpl(context.getModel())); 517 } 518 @Override 519 public WSDLComponent create(WSDLComponent context, Element element) { 520 return new LaxTsLastImpl(context.getModel(), element); 521 } 522 } 523 524 public static class RequiredElementsFactory extends ElementFactory { 525 @Override 526 public Set <QName > getElementQNames() { 527 return Collections.singleton(SecurityPolicyQName.REQUIREDELEMENTS.getQName()); 528 } 529 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 530 return type.cast(new RequiredElementsImpl(context.getModel())); 531 } 532 @Override 533 public WSDLComponent create(WSDLComponent context, Element element) { 534 return new RequiredElementsImpl(context.getModel(), element); 535 } 536 } 537 538 public static class BootstrapPolicyFactory extends ElementFactory { 539 @Override 540 public Set <QName > getElementQNames() { 541 return Collections.singleton(SecurityPolicyQName.BOOTSTRAPPOLICY.getQName()); 542 } 543 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 544 return type.cast(new BootstrapPolicyImpl(context.getModel())); 545 } 546 @Override 547 public WSDLComponent create(WSDLComponent context, Element element) { 548 return new BootstrapPolicyImpl(context.getModel(), element); 549 } 550 } 551 } 552 | Popular Tags |