From 7ace7a8cf3173112717904aa825a7481dd0804e8 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sun, 24 Jul 2011 14:23:03 +0200 Subject: [PATCH] added comment headers. --- .gitignore | 5 +++ .../java/org/wamblee/xmlrouter/common/Id.java | 15 ++++++++ .../org/wamblee/xmlrouter/config/Config.java | 2 +- .../xmlrouter/config/DocumentType.java | 15 ++++++++ .../org/wamblee/xmlrouter/config/Filter.java | 15 ++++++++ .../org/wamblee/xmlrouter/config/Rule.java | 2 +- .../xmlrouter/config/Transformation.java | 20 +++++++++++ .../org/wamblee/xmlrouter/impl/Constants.java | 17 ++++++++- .../xmlrouter/impl/RobustDestination.java | 15 ++++++++ .../wamblee/xmlrouter/impl/RobustFilter.java | 15 ++++++++ .../xmlrouter/impl/RobustTransformation.java | 36 +++++++++++++++++++ .../xmlrouter/impl/TransformationPath.java | 15 ++++++++ .../xmlrouter/impl/Transformations.java | 17 ++++++++- .../org/wamblee/xmlrouter/impl/XMLRouter.java | 15 ++++++++ .../xmlrouter/impl/RobustDestinationTest.java | 15 ++++++++ .../xmlrouter/impl/RobustFilterTest.java | 15 ++++++++ .../impl/RobustTransformationTest.java | 15 ++++++++ .../xmlrouter/impl/TransformationsTest.java | 20 +++++++++++ .../wamblee/xmlrouter/impl/XMLRouterTest.java | 15 ++++++++ .../wamblee/xmlrouter/publish/Gateway.java | 2 +- .../xmlrouter/subscribe/Destination.java | 2 +- .../subscribe/DestinationRegistry.java | 2 +- .../subscribe/RegistrationException.java | 2 +- 23 files changed, 284 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..19e6660 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +target/ +.settings/ +.classpath +.project + diff --git a/common/src/main/java/org/wamblee/xmlrouter/common/Id.java b/common/src/main/java/org/wamblee/xmlrouter/common/Id.java index 504459a..bc23999 100644 --- a/common/src/main/java/org/wamblee/xmlrouter/common/Id.java +++ b/common/src/main/java/org/wamblee/xmlrouter/common/Id.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.common; public class Id { diff --git a/config/src/main/java/org/wamblee/xmlrouter/config/Config.java b/config/src/main/java/org/wamblee/xmlrouter/config/Config.java index 940b346..9ecdcfe 100644 --- a/config/src/main/java/org/wamblee/xmlrouter/config/Config.java +++ b/config/src/main/java/org/wamblee/xmlrouter/config/Config.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.xmlrouter.config; import java.util.Collection; diff --git a/config/src/main/java/org/wamblee/xmlrouter/config/DocumentType.java b/config/src/main/java/org/wamblee/xmlrouter/config/DocumentType.java index edcf294..9b04ec6 100644 --- a/config/src/main/java/org/wamblee/xmlrouter/config/DocumentType.java +++ b/config/src/main/java/org/wamblee/xmlrouter/config/DocumentType.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.config; import javax.xml.transform.dom.DOMSource; diff --git a/config/src/main/java/org/wamblee/xmlrouter/config/Filter.java b/config/src/main/java/org/wamblee/xmlrouter/config/Filter.java index db9dee9..3f32971 100644 --- a/config/src/main/java/org/wamblee/xmlrouter/config/Filter.java +++ b/config/src/main/java/org/wamblee/xmlrouter/config/Filter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.config; import javax.xml.transform.dom.DOMSource; diff --git a/config/src/main/java/org/wamblee/xmlrouter/config/Rule.java b/config/src/main/java/org/wamblee/xmlrouter/config/Rule.java index e8bbfb4..8aca8b1 100644 --- a/config/src/main/java/org/wamblee/xmlrouter/config/Rule.java +++ b/config/src/main/java/org/wamblee/xmlrouter/config/Rule.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.xmlrouter.config; import org.wamblee.xml.XMLDocument; diff --git a/config/src/main/java/org/wamblee/xmlrouter/config/Transformation.java b/config/src/main/java/org/wamblee/xmlrouter/config/Transformation.java index b681afc..e7757a6 100644 --- a/config/src/main/java/org/wamblee/xmlrouter/config/Transformation.java +++ b/config/src/main/java/org/wamblee/xmlrouter/config/Transformation.java @@ -1,8 +1,28 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.config; import javax.xml.transform.dom.DOMSource; public interface Transformation { + + /** + * @return Name for the transformation. + */ + String getName(); /** * From type that can be transformed. diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/Constants.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/Constants.java index 057c90f..c8daa26 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/Constants.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/Constants.java @@ -1,5 +1,20 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; public enum Constants { - UNKNOWN_DOCUMENT_TYPE, UNKNOWN_DESTINATION_NAME + UNKNOWN_DOCUMENT_TYPE, UNKNOWN_DESTINATION_NAME, UNKNOWN_NAME } diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustDestination.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustDestination.java index 6de2c19..487706d 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustDestination.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustDestination.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import java.util.ArrayList; diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustFilter.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustFilter.java index 413ae92..9f85d28 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustFilter.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustFilter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import java.util.logging.Level; diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustTransformation.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustTransformation.java index fb028ae..d398230 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustTransformation.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/RobustTransformation.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import java.util.logging.Level; @@ -22,6 +37,21 @@ public class RobustTransformation implements Transformation { id = aId; transformation = aTransformation; } + + @Override + public String getName() { + try { + String name = transformation.getName(); + if (name == null) { + logTypeReturnedNull("from"); + return Constants.UNKNOWN_DOCUMENT_TYPE.toString(); + } + return name; + } catch (Exception e) { + logNameThrewException(e); + return Constants.UNKNOWN_DOCUMENT_TYPE.toString(); + } + } @Override public String getFromType() { @@ -68,6 +98,12 @@ public class RobustTransformation implements Transformation { } } + private void logNameThrewException(Exception aE) { + LOGGER.log(Level.WARNING, "getName" + + " threw exception, returning default value " + + Constants.UNKNOWN_NAME, aE); + } + private void logTypeThrewException(String aFromTo, Exception aE) { LOGGER.log(Level.WARNING, "get" + aFromTo + " threw exception, returning default value " + diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/TransformationPath.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/TransformationPath.java index c054f90..359b4b4 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/TransformationPath.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/TransformationPath.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import java.util.ArrayList; diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/Transformations.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/Transformations.java index 07d086b..212d36b 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/Transformations.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/Transformations.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import java.util.ArrayList; @@ -156,4 +171,4 @@ public class Transformations { buf.append(")"); return buf.toString(); } -} \ No newline at end of file +} diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/XMLRouter.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/XMLRouter.java index 85a51df..652a2ff 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/XMLRouter.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/XMLRouter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import java.util.ArrayList; diff --git a/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustDestinationTest.java b/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustDestinationTest.java index 397f7b2..4ba1609 100644 --- a/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustDestinationTest.java +++ b/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustDestinationTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import static junit.framework.Assert.*; diff --git a/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustFilterTest.java b/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustFilterTest.java index 7c10282..3a948eb 100644 --- a/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustFilterTest.java +++ b/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustFilterTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import static junit.framework.Assert.*; diff --git a/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustTransformationTest.java b/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustTransformationTest.java index ea76c54..967b0e2 100644 --- a/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustTransformationTest.java +++ b/impl/src/test/java/org/wamblee/xmlrouter/impl/RobustTransformationTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import static junit.framework.Assert.*; diff --git a/impl/src/test/java/org/wamblee/xmlrouter/impl/TransformationsTest.java b/impl/src/test/java/org/wamblee/xmlrouter/impl/TransformationsTest.java index 8489f89..9da9c35 100644 --- a/impl/src/test/java/org/wamblee/xmlrouter/impl/TransformationsTest.java +++ b/impl/src/test/java/org/wamblee/xmlrouter/impl/TransformationsTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import static junit.framework.Assert.*; @@ -22,6 +37,11 @@ public class TransformationsTest { from = aFrom; to = aTo; } + + @Override + public String getName() { + return "myname"; + } @Override public String getFromType() { diff --git a/impl/src/test/java/org/wamblee/xmlrouter/impl/XMLRouterTest.java b/impl/src/test/java/org/wamblee/xmlrouter/impl/XMLRouterTest.java index c4a73ba..50fa4f8 100644 --- a/impl/src/test/java/org/wamblee/xmlrouter/impl/XMLRouterTest.java +++ b/impl/src/test/java/org/wamblee/xmlrouter/impl/XMLRouterTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.xmlrouter.impl; import static junit.framework.Assert.*; diff --git a/publish/src/main/java/org/wamblee/xmlrouter/publish/Gateway.java b/publish/src/main/java/org/wamblee/xmlrouter/publish/Gateway.java index f181a27..533ba2c 100644 --- a/publish/src/main/java/org/wamblee/xmlrouter/publish/Gateway.java +++ b/publish/src/main/java/org/wamblee/xmlrouter/publish/Gateway.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.xmlrouter.publish; import javax.xml.transform.dom.DOMSource; diff --git a/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/Destination.java b/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/Destination.java index a0c7b94..a6a0d32 100644 --- a/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/Destination.java +++ b/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/Destination.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.xmlrouter.subscribe; import java.util.Collection; diff --git a/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/DestinationRegistry.java b/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/DestinationRegistry.java index 87f9265..49bd143 100644 --- a/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/DestinationRegistry.java +++ b/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/DestinationRegistry.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.xmlrouter.subscribe; import org.wamblee.xmlrouter.common.Id; diff --git a/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/RegistrationException.java b/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/RegistrationException.java index 7b57e8b..3af368f 100644 --- a/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/RegistrationException.java +++ b/subscribe/src/main/java/org/wamblee/xmlrouter/subscribe/RegistrationException.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.xmlrouter.subscribe; -- 2.31.1